vue-airbnb-style-datepicker icon indicating copy to clipboard operation
vue-airbnb-style-datepicker copied to clipboard

Compatibility with date-fns v2.0.x

Open noahbornstein opened this issue 6 years ago • 14 comments

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?

noahbornstein avatar Oct 04 '18 20:10 noahbornstein

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.

MikaelEdebro avatar Oct 06 '18 12:10 MikaelEdebro

I created an issue: https://github.com/date-fns/date-fns/issues/917

MikaelEdebro avatar Oct 06 '18 13:10 MikaelEdebro

Currently still in alpha. I will wait until Beta is released.

MikaelEdebro avatar Mar 30 '19 07:03 MikaelEdebro

Betas are in :) https://github.com/date-fns/date-fns/releases

sungraze avatar Jul 05 '19 11:07 sungraze

date-fns v2 is out https://github.com/date-fns/date-fns/releases/tag/v2.0.0

DavidRouyer avatar Aug 21 '19 20:08 DavidRouyer

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.

Darkecudoua avatar Aug 27 '19 12:08 Darkecudoua

v2 is official https://github.com/date-fns/date-fns/releases/tag/v2.0.0

ThomasRalee avatar Aug 28 '19 03:08 ThomasRalee

@MikaelEdebro Any plans to upgrade to V2.0?

kfirba avatar Sep 04 '19 11:09 kfirba

Waiting for V2.0

marufmax avatar Oct 17 '19 06:10 marufmax

After installing date-fns dependencie it will work

o-Chamie-o avatar Oct 29 '19 15:10 o-Chamie-o

@o-Chamie-o did you install it in your project package.json or did you try to fix it in the airbnb-style-datepicker?

lfritsche avatar Nov 20 '19 12:11 lfritsche

In fact I had to force version like this in package.json

"date-fns": "1.29.0",

o-Chamie-o avatar Nov 20 '19 13:11 o-Chamie-o

I think this package can mark as abandonned. :(

bnd170 avatar Nov 21 '19 12:11 bnd170

Yeah, it is abandoned. Use https://vcalendar.io it has all the features.

avxkim avatar Apr 03 '20 19:04 avxkim