Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to date-fns v2 #1064

Closed
mattlewis92 opened this issue Aug 20, 2019 · 13 comments · Fixed by #1070
Closed

Upgrade to date-fns v2 #1064

mattlewis92 opened this issue Aug 20, 2019 · 13 comments · Fixed by #1070
Labels
dependencies Pull requests that update a dependency file has PR
Milestone

Comments

@mattlewis92
Copy link
Owner

mattlewis92 commented Aug 20, 2019

As it ships ES modules we can finally remove all the deep imports and just import directly from date-fns 🎉

@mattlewis92 mattlewis92 added the dependencies Pull requests that update a dependency file label Aug 20, 2019
@mattlewis92 mattlewis92 added this to the 0.28 milestone Aug 20, 2019
@Enngage
Copy link

Enngage commented Aug 21, 2019

Awesome! Just tried updating date-fns and came to this repo to see if there are any plans for this :-)

@mattlewis92
Copy link
Owner Author

mattlewis92 commented Aug 21, 2019

I'll try and get a beta out with it this week 😄 In the meantime if you want it today you can add this custom date adapter for v2: #963 (comment)

mattlewis92 added a commit that referenced this issue Aug 23, 2019
BREAKING CHANGE: date-fns v2 or higher is now required as a peer dependency

If implementing a custom adapter, the `max` function signature has changed to accept an array of dates, instead of an infinite argument list.

The date adapters no longer accept strings as input arguments.

Closes #1064
@mattlewis92
Copy link
Owner Author

I just published a new beta with date-fns v2, please upgrade and try it today with:

npm i angular-calendar@next

@Enngage
Copy link

Enngage commented Aug 24, 2019

Just tried 0.28.0-beta.1 and it seems to work perfectly fine :-)

@mattlewis92
Copy link
Owner Author

Awesome, thanks for testing it @Enngage! 😄

@mattlewis92 mattlewis92 mentioned this issue Aug 24, 2019
@adisco4420
Copy link

I just published a new beta with date-fns v2, please upgrade and try it today with:

npm i angular-calendar@next

I just tried if for Angular 7 and it working perfectly Thanks so much

@Danieliverant
Copy link

@mattlewis92
Thanks!!!
works perfectly on Angular 8.

if someone has errors using full-calendar v2 with date-fns v2 upgrade to the beta:
date-fns/date-fns#1394

mattlewis92 added a commit that referenced this issue Sep 4, 2019
BREAKING CHANGE: date-fns v2 or higher is now required as a peer dependency

If implementing a custom adapter, the `max` function signature has changed to accept an array of dates, instead of an infinite argument list.

The date adapters no longer accept strings as input arguments.

Closes #1064
mattlewis92 added a commit that referenced this issue Sep 4, 2019
BREAKING CHANGE: date-fns v2 or higher is now required as a peer dependency

If implementing a custom adapter, the `max` function signature has changed to accept an array of dates, instead of an infinite argument list.

The date adapters no longer accept strings as input arguments.

Closes #1064
@sysmat
Copy link

sysmat commented Sep 24, 2019

I have problem with new date-fns.

  • dependencies:
"@angular-devkit/core": "8.3.5",
"@angular-devkit/schematics": "8.3.5",
"@angular/common": "8.2.7",
"@angular/compiler": "8.2.7",
"@angular/core": "8.2.7",
"angular-calendar": "0.28.0-beta.4",
"date-fns": "2.2.1",
  • devDependencies:
"@angular-devkit/build-angular": "0.803.5",
"@angular/cli": "8.3.5",
"@angular/compiler-cli": "8.2.7",

  • NO IVY compiler
  • app.module:
CalendarModule.forRoot({
      provide: DateAdapter,
      useFactory: adapterFactory
    })

  • Error:

ERROR in Can't bind to 'eventWidth' since it isn't a known property of 'mwl-calendar-day-view'.
1. If 'mwl-calendar-day-view' is an Angular component and it has 'eventWidth' input, then verify that it is part of this module.
2. If 'mwl-calendar-day-view' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("    [viewDate]="viewDate"
                           [events]="events"
                           [ERROR ->][eventWidth]="900"
                           dayEndHour="20"
                           [refresh]=")

Regards, Tomaž

@mattlewis92
Copy link
Owner Author

@sysmat please check the breaking changes over at #1070, eventWidth was removed as events now fill the available width.

@sysmat
Copy link

sysmat commented Sep 25, 2019

@mattlewis92 thx it works with beta version

@tom-englert
Copy link

@mattlewis92 I had the same problem - shouldn't the date adapter implementations be shipped as a separate module, so angular-calendar has NO dependency to any date library?
This would solve all future conflicts, and users could use ANY version of any date library with the calendar.

@mattlewis92
Copy link
Owner Author

@tom-englert date adapters essentially are already separate modules, but just included in the angular-calendar package as sub modules for convenience so you don't have to npm install even more stuff e.g.

import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';

and

import { adapterFactory } from 'angular-calendar/date-adapters/moment';

The only real benefit having them as separate packages would get you is that you could add peer dependencies to date-fns and moment respectively, but that will mostly be solved with optional peer dependencies, and they would have separate versioning from the main package so I could have already released the date-fns v2 adapter as stable already (but you can already use the next version of the calendar with npm i angular-calendar@next that has date-fns v2.)

@tom-englert
Copy link

I see, I think I had missed a stale import of the date-fns adapter in my code, that's why I got the compile error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file has PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants