Angular-calendar: Upgrade to date-fns v2

Created on 20 Aug 2019  路  13Comments  路  Source: mattlewis92/angular-calendar

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

has PR dependencies

Most helpful comment

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

npm i angular-calendar@next

All 13 comments

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

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: https://github.com/mattlewis92/angular-calendar/issues/963#issuecomment-489318417

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

npm i angular-calendar@next

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

Awesome, thanks for testing it @Enngage! 馃槃

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

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

if someone has errors using full-calendar v2 with date-fns v2 upgrade to the beta:
https://github.com/date-fns/date-fns/issues/1394

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啪

@sysmat please check the breaking changes over at https://github.com/mattlewis92/angular-calendar/pull/1070, eventWidth was removed as events now fill the available width.

@mattlewis92 thx it works with beta version

@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.

@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.)

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sushma-tiwari picture Sushma-tiwari  路  3Comments

sylvain-fr picture sylvain-fr  路  3Comments

Novabllast picture Novabllast  路  3Comments

oldschoolbg picture oldschoolbg  路  4Comments

PrasannaKolla picture PrasannaKolla  路  4Comments