A VueJs datepicker with a similar look and functionality as the popular AirBnb datepicker.

Overview

vue-airbnb-style-datepicker

This is a VueJs version of the popular AirBnb datepicker. Supports range selection, disabling of dates, custom configuration, and many more things. Really lightweight and good browser support!
Examples

Datepicker on tablet

Datepicker on mobile

Documentation

Full documentation on GitBooks

Browser support

This datepicker have been tested with the following browsers/OS:

Chrome
Firefox
Edge
Android
IE: 9 and higher
Safari: 7.1 and higher
iOS: 6 and higher

However, these tests have not been extensive. More or less just trying the datepicker out, and see that it doesn't throw any console errors etc. If you're planning on using this in production, make sure that it runs smoothly in the browsers that you're planning on supporting.

Contribute

I gladly accept contributions to improve this datepicker. But before you start hacking away, please first create an issue where you explain what it is that you think needs to be done and why, so we can agree that the changes makes sense. I wan't to keep this datepicker as close as possible to the original Airbnb datepicker, and not add strange edge cases that complicates the API and makes the size bigger. And it sucks having to deny a PR that someone spent time on, just because the feature/implementation doesn't cut it.

Roadmap/todo:s

  • Improve logic for positioning of datepicker. Support for showing the datepicker above the input if it doesn't fit below.
Comments
  • Some minor design suggestions

    Some minor design suggestions

    Hello, thank you for making this awesome component. Thank you for the CDN version. I have some minor design suggestions:

    1. The buttons (change-month-button and action-buttons) could have cursor: pointer; style.
    2. The date buttons could have :hover color
    3. The change-month-buttons could have :focused colors
    4. The day.in-range buttons could have normal font-weight, not bold
    5. The selected days buttons borders could have #33dacd color
    6. The hidden months affect the height of the datepicker, and sometimes there is unnecessary empty space at the bottom.

    I know 5 of these are easy to fix/change and people can change them in the CSS styles, but i wanted to give these suggestions to make it more similar to the original component.

    Thank you for making this component.

    opened by TheAndroidGuy 13
  • Not trigger in modal

    Not trigger in modal

    I have two datepicker, one in the modal window, and one outside it. Trigger-element-id are different. When I show modal, datepicker not trigger on my input :(

    I use bootstrap-vue, and component bModal

    opened by de-don 11
  • Year/Month selection

    Year/Month selection

    Hello,

    First, thank you. This datepicker is one of the best that I found 😄

    I was wondering if it was possible to implement a kind of Month selection and year selection when clicking on the year.

    Thanks by advance for your answer

    Matthieu

    opened by matthieudou 9
  • Package conflicting with vuetify, causing an error

    Package conflicting with vuetify, causing an error

    "vue-airbnb-style-datepicker": "^1.9.0" "vuetify": "^1.2.5"

    The error is not that easy to understand since it happens everywhere even if it doesn't even have a vue-airbnb-style-datepicker, so I t hink this is a global listener which should not be the case.

    But the error I get is the following:

    Uncaught TypeError: vnode.context[binding.expression] is not a function
        at HTMLBodyElement.el.event (vue-airbnb-style-datepicker.es.js:697)
    

    The stack trace: el.event @ vue-airbnb-style-datepicker.es.js:697

    This causes the vuetify component not to be able to close when clicking outside it's span area. The affected component works properly once vue-airbnb-style-datepicker plugin is disabled so it is a problem with this event handling.

    Edit: I've tracked the issue down, and its due to de click outside directive which is being handled globally instead of being contained in the component scope, this is affecting all other elements like comboboxes, dropdown menus, preventing them from closing in

    opened by MrToxy 8
  • month/year select

    month/year select

    Implements #40 and also fixes 2 accessibility bugs on ie11/edge/mobile devices

    • creates resize-select directive, which is used to ensure that the month/year select dropdowns are the correct width (usually, select dropdowns default to being as wide as their widest option, this directive makes them as wide as the currently selected option)
    • adds showMonthYearSelect and yearsForSelect props

    bugfixes

    • fixes accessibility keyboard trap logic in ie11 (Object.values is not supported in ie11)
    • adds a timeout to setFocusedDate in order to fix focus logic across devices (before, focus was being applied inconsistently on mobile as well as ie11/edge)
    opened by coleww 7
  • Being able to show or hide the datepicker

    Being able to show or hide the datepicker

    Currently there is a trigger property that can be used to show the datepicker.

    I want to hide the datepicker when the user selects a second date. I've tried to change this trigger inside a @date-two-selected event handler, but when change the value of the trigger property everything goes erratic, and does not work.

    I'm not sure what is the best way to resolve this, maybe add a prop to control the displaying status from the outside, or an event listener for the datepicker to react to.

    opened by tehuel 6
  • accessibility support

    accessibility support

    Hello, would you be open to a PR that adds accessibility support to this component? This would involve adding aria- tags to the various elements to enhance screen reader support, as well as enabling keyboard navigation of the component. I would be happy to follow the exact accessibility patterns that are being used inside the airbnb react date picker to maintain consistency between the two components. My team at work would like to use this component in an upcoming project, so I would have paid time to do work on this in the next couple weeks.

    The only issue I see with doing that is this component currently uses left/right arrow for changing months, whereas airbnb uses left/right for picking dates and pgup/pgdn to switch months. These are the keys that the airbnb date picker is currently using for keyboard navigation (found inside the ? icon in the bottom right corner of their component http://airbnb.io/react-dates/)

    ↵ Select the date in focus.
    ←/→ Move backward (left) and forward (right) by one day.
    ↑/↓ Move backward (up) and forward (down) by one week.
    PGUP/PGDN Switch months.
    HOME/END Go to the first or last day of a week.
    ESC Return to the date input field.
    ? Open this panel.
    
    opened by coleww 5
  • When min-date is set to a future date, the calendar should default to the month of that min-date

    When min-date is set to a future date, the calendar should default to the month of that min-date

    Firstly, thanks for creating this. It's working like a charm for me mostly.

    Came across this unexpected behaviour where the default shown month in the calendar is non-ideal.

    To reproduce:

    1. Set a min-date that is dynamic
    2. Update this min-date to a future month (ie, from a related datepicker)
    3. Trigger the calendar.

    It will show the initial min-date's calendar month which consists of non-selectable dates.

    Expected behaviour: go to the month where the min-date falls by default.

    Bonus: add an option to set the default month to show when calendar is triggered. I believe this property is called "initialVisibleMonth" in the Airbnb version.

    opened by daamsie 5
  • Clear dates

    Clear dates

    Hi,

    how can i clear the dates? tried to add a function on the click cancel button but no event is emitted on the click button. any recommedation on how to implement this clear dates functionality?

    opened by VincentMRA 5
  • The client-side rendered virtual DOM tree is not matching server-rendered content

    The client-side rendered virtual DOM tree is not matching server-rendered content

    Having this error while use with Nuxt.js

    The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside

    , or missing . Bailing hydration and performing full client-side render.

    help wanted 
    opened by wijnho 5
  • Allow to propagate date changes only if

    Allow to propagate date changes only if "Apply" button has been pressed

    Hi Mikael,

    first of all thanks for sharing your datepicker, I found it very neat and easy to use. I'd like to suggest a new feature: be able to "Cancel" a date selection, or in other words, require to explicitly press the "Apply" button before the dates are changed.

    In my PR you can see that I still propagate the date changes while the user is selecting the date range, but if the user presses Cancel, or clicks outside the date selector, the changes are reverted. Otherwise, if the user presses "Apply" the new dates are kept as selected. Also, I've added an explicit event to let the parent app know when dates have been applied following a click on "Apply" button.

    To avoid introducing behaviour changes I've wrapped this new feature within a new property "require-apply" set to False by default.

    Thanks again for sharing this,

    Luca

    opened by pdvluca 5
  • How to add default first date in 'range' so user can select second date only?

    How to add default first date in 'range' so user can select second date only?

    I have set :date-one="dateOne" and when I open datepicker, the first date is selected but when I click any other date to select the second date, it disselects the already selected first date and considers newly selected as first date.

    opened by Ahmdrza 0
  • Disable all dates with an empty array for enabledDates

    Disable all dates with an empty array for enabledDates

    If I pass an empty array to the enabledDates prop, the expected behavior would be that all dates are disabled. Yet, an empty array doesn't disable any dates.

    isDateDisabled(date) {
      if (this.enabledDates.length > 0) {
        return this.enabledDates.indexOf(date) === -1
      } else {
        return this.disabledDates.indexOf(date) > -1
      }
    }
    

    The functionality of the above method needs to be reconsidered.

    opened by diakonovm 0
  • Update date-fns package

    Update date-fns package

    date-fns v2 is out! so update AirbnbStyleDatepicker.vue component. Please! rewrite imports like example: import { format, formatDistance, formatRelative, subDays } from 'date-fns'

    opened by Jhersyvb 0
  • Changing months animation gets

    Changing months animation gets "stuck" or frozen when displaying a single month

    If you have :months-to-show="1" a couple of different bugs occur, when changing months with the keyboard arrows, depending upon which browser you are using.

    In Safari, the calendar will get stuck between animations. In Chrome, the animation works fine, however, the next month's date will not be selected and you will have to click with the mouse in the new month in order to begin using the keyboard again.

    The issue appears to be occurring within the setFocusedDate method, as there is a 10ms setTimeout to focus the next date, according to the comments this is an ie11 "hack." I believe, the reason it is getting stuck is that it is trying to select the next date, however, the animation transition is 300ms. So it is trying to select the next date (10ms) before the animation is finished (300ms).

    Locally I have managed to hack something together to get this working, I am more than happy to push up a PR, however, it looks like there has been no activity in this repo almost 1 year.

    @MikaelEdebro can you let me know if you are still actively maintaining this and if you would like for me to submit this PR?

    opened by robertguss 0
  • Trigger an event when a month or year selected from the picker

    Trigger an event when a month or year selected from the picker

    There are event triggers when month changes to previous or next but they are not being triggered when a month is selected from the picker. I'm hoping that there will be also for the year.

    opened by jirehnimes 0
Releases(v2.6.0)
  • v2.6.0(Mar 30, 2019)

  • v2.5.0(Mar 21, 2019)

  • v2.4.0(Dec 2, 2018)

    In this release, I addressed some issues that this component had running together with Vuetify. Hopefully these issues should be resolved now.

    Also a new prop closeAfterSelect, to allow you to close the datepicker after all dates have been selected.

    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Nov 16, 2018)

    This release introduces some new features that makes it easier to jump months/years.

    • Year/month selection #40
    • Stylesheet breaks design #61
    • Make sure Prettier is ran on precommit hook, to enforce code consistency.
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Oct 7, 2018)

    • Fix for making plugin work in Server-Side Rendered projects.
    • New prop for enabled dates. Disable all dates except the ones specified in :enabled-dates="['2018-10-12', '2018-10-21']"
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Oct 1, 2018)

    Note, there are a breaking change for people using a previous version of this plugin. Path to CSS file has changed. See docs for new path: https://mikaeledebro.gitbooks.io/vue-airbnb-style-datepicker/INSTALLATION.html

    Accessibility support This plugin now have better screen reader support. Thanks @coleww for the great contribution.

    Source code(tar.gz)
    Source code(zip)
  • v1.11.1(Jul 23, 2018)

  • v1.10.0(Jul 23, 2018)

    Issue 38 - Fix issue where datepicker did not update what months to show properly if minDate changed dynamically.

    Issue 25 - Set classes on selected date (.asd__selected-date-one & .asd__selected-date-two)

    Issue 37 - Fix mobile header fallback text. "Select date" for single mode, "Select dates" for range mode.

    Source code(tar.gz)
    Source code(zip)
  • v1.9.0(Jun 3, 2018)

    New events added when changing months.

    @previous-month="showVisibleMonths" @next-month="showVisibleMonths"

    methods: {
      showVisibleMonths(visibleMonths) {
        console.log(visibleMonths)   // ['2019-01-01', '2019-02-01']
      }
    }
    
    Source code(tar.gz)
    Source code(zip)
  • v1.8.0(May 10, 2018)

  • v1.7.1(Apr 18, 2018)

    • Improved keyboard navigation support. And some general refactorings regarding event handling.
    • CSS class name changes, in order to avoid other CSS interfering with datepicker (and vice versa). This might be a breaking change if you are overriding the styles
    • Added @apply event, that gets emitted when clicking "Apply"
    • Fix to only emit @closed event when datepicker is open, and not in inline mode
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Mar 26, 2018)

    Fixed an issue where you could not use localized day names.

    Also added ability to pass in localized month names.

    Also some improved validation for options. Before if I passed in texts: { apply: 'Some' }, the whole texts object got overwritten. Now we only set the props that are actually passed.

    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Mar 26, 2018)

    Changed implementation so it no longer automatically installs plugin for CDN version. Instead, you need to install it with Vue.use(). This way you can also configure the datepicker by passing options: Vue.use(window.AirbnbStyleDatepicker, { sundayFirst: true })

    For more info: https://mikaeledebro.gitbooks.io/vue-airbnb-style-datepicker/USAGE-WITH-CDN.html

    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Mar 25, 2018)

    Now datepicker will select you you enter a valid date in the trigger input.

    Only enabled when mode: 'single'. Accepts both YYYY-MM-DD and DD.MM.YYYY formats.

    Also some fixes behind the scenes, so datepicker GUI is updated if date props are changed by parent component.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Mar 24, 2018)

  • v1.2.8(Mar 24, 2018)

This datepicker is a fully customisable Vue(v2.1.6) version of the material-ui datepicker

vue-material-datepicker This datepicker is a fully customisable Vue(v2.1.6) version of the material-ui datepicker that fit all your projects. See belo

Bastien Granger 54 Dec 13, 2021
Not your ordinary datepicker. A Vuejs draggable date selector with a fresh responsive design, mobile ready and 0 dependencies, 17kb gzipped

DraggableCal A datepicker Vue component. Compatible with Vue 2.x Demo Install Usage Available Languages Dev & Build Licence Thanks Demo To view a demo

Tom 86 Dec 1, 2022
A clean datepicker made with VueJs

vue-datepicker A datepicker Vue component. Compatible with Vue 2.x Demo Install Usage Props Events Date Formatting Translations Best Practices Demo To

Mathieu Stanowski 160 Dec 23, 2022
[Deprecated] calendar and datepicker component with material design for Vue.js

vue-datepicker calendar and datepicker component with material design for Vue.js Demo The demo page is HERE. Requirements Vue.js ^1.0.0 & ^2.0.0 momen

Awe 706 Nov 21, 2022
Jalaali calendar and datepicker for vue.js 2

vue-jalaali-datepicker Jalaali calendar and datepicker for vue.js 2 Demo Requirements Vue.js ^2.0.0 moment-jalaali ^0.6.0 Installation npm $ npm insta

Peyman 13 Nov 24, 2022
Litepie Datepicker is a date range picker component for Vue.js and Tailwind CSS, dependent to day.js.

Litepie Datepicker is a date range picker component for Vue.js and Tailwind CSS, dependent to day.js. Documentation For full documentation, visit lite

Ken 346 Jan 3, 2023
Datepicker component for vue.js built with Tailwind CSS, and the day.js date library.

Datepicker component for vue.js build with Tailwind CSS & dayjs date library

Ken 188 Nov 11, 2022
vue 3 datepicker. supports disabling, highlighting of dates and programmatic access of date.

Vue 3 Datepicker A datepicker Vue component. Compatible with Vue 3 Only Demo Install Usage Date Formatting Props Events Disabled dates Highlighted dat

shubhadip 38 Dec 15, 2022
A lightweight and easy to use Vue.js datepicker component

A lightweight and easy to use Vue.js datepicker component (created for Vue 2.x)

Matt Areddia 0 Feb 5, 2019
Vue Nuxt Scroll Datepicker - Fast, powerful and easy to use component datetime picker for Nuxt Vue

Vue Nuxt Scroll Datepicker - Cashbac In this article, we’ll look at how date and time picker and a virtual scroll. Fast, powerful and easy to use comp

mohammad ichlas 2 Apr 25, 2022
A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations

Datepicker A datepicker Vue component. Compatible with Vue 2.x Demo Install Usage Date Formatting Props Events Disabled dates Highlighted dates Transl

Charlie Kassel 2.6k Jan 3, 2023
A vue component that provides datepicker for persian developers

vue persian datepicker This is a Jalali date picker component for Vue. این برنامه یک کامپوننت انتخاب تاریخ جلالی می باشد. Demo You can see a demo and

Dyon Software Development Group 100 Oct 1, 2022
A Beautiful Datepicker Component For Vue2

vue-datepicker-local A Beautiful Datepicker Component For Vue2 Lightweight (less than 5kb minified and gzipped) Only dependencies Vue Beautiful! Demo

飞越 300 Dec 13, 2022
datepicker component for Vue 2.x

vue-date-picker datepicker component for Vue 2.x Screenshot Instllation $ npm install vue-date-picker --save Usage <template> <div class="demo">

8788 101 Nov 21, 2022
A simple datepicker component for vue3.0

A simple datepicker component for vue3.0

Lin Masahiro 34 Dec 14, 2022
awesome, zero dependency, performant Vue datepicker component

awesome, zero dependency, performant Vue datepicker component

mohammad S. 36 Oct 31, 2022
Vue Datepicker Component

Datepicker Component For Vue

Hatice Edis 405 Jan 5, 2023
Datepicker component for Vue 3

The most complete date picker solution for Vue 3

null 158 Dec 27, 2022
Simple datepicker component for Vue 3

Simple datepicker component for Vue 3

Ilya Borovitinov 111 Dec 17, 2022