vue-airbnb-style-datepicker
vue-airbnb-style-datepicker copied to clipboard
Compatibility with date-fns v2.0.x
I'm getting complaints that dependencies are not installed during build:
These dependencies were not found:
* date-fns/add_days in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/add_months in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/add_weeks in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/end_of_week in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/get_days_in_month in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/get_month in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/get_year in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/is_after in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/is_before in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/is_same_day in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/is_same_month in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/is_valid in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/last_day_of_month in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/set_month in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/set_year in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/start_of_week in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/sub_days in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/sub_months in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
* date-fns/sub_weeks in ./node_modules/vue-airbnb-style-datepicker/dist/vue-airbnb-style-datepicker.es.js
To install them, you can run: npm install --save date-fns/add_days date-fns/add_months date-fns/add_weeks date-fns/end_of_week date-fns/get_days_in_month date-fns/get_month date-fns/get_year date-fns/is_after date-fns/is_before date-fns/is_same_day date-fns/is_same_month date-fns/is_valid date-fns/last_day_of_month date-fns/set_month date-fns/set_year date-fns/start_of_week date-fns/sub_days date-fns/sub_months date-fns/sub_weeks
If I go into vue-airbnb-style-datepicker.es.js
and change
import subMonths from 'date-fns/sub_months';
to
import subMonths from 'date-fns';
or import subMonths from 'date-fns/subMonths';
it will work. Unfortunately, that's not a possibility for deployed environments, using docker, other build tools, etc.
Any ideas on workarounds?
Ahh, seems like they have changed the names of the imports in date-fns 2.x. In the stable version (1.29.0) they use underscore for the ES2015 modules: https://date-fns.org/v1.29.0/docs/addDays
I have to think about how to go about this. But I might do a release with breaking changes and update to date-fns 2.0. However, it will not be done before it's released as a stable version (currently only in alpha).
My only suggestion for the moment is to use the stable version of date-fns. It's a shame they havn't added some logic to handle backwards compatibility.
I created an issue: https://github.com/date-fns/date-fns/issues/917
Currently still in alpha. I will wait until Beta is released.
Betas are in :) https://github.com/date-fns/date-fns/releases
date-fns v2 is out https://github.com/date-fns/date-fns/releases/tag/v2.0.0
Has this been handled? I tried to install the date picker and the terminal cries after date-fns. I installed the latest version of date-fns to no avail.
v2 is official https://github.com/date-fns/date-fns/releases/tag/v2.0.0
@MikaelEdebro Any plans to upgrade to V2.0?
Waiting for V2.0
After installing date-fns dependencie it will work
@o-Chamie-o did you install it in your project package.json or did you try to fix it in the airbnb-style-datepicker?
In fact I had to force version like this in package.json
"date-fns": "1.29.0",
I think this package can mark as abandonned. :(
Yeah, it is abandoned. Use https://vcalendar.io it has all the features.