Open rmonteroh opened 2 years ago
Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider sponsoring me
I have the same issue. Moreover, in the week view the start time changes. If my time zone is +1, then it starts from 11pm instead of 12am
I fix this issue by moving the providers from the parent component module to the child component module
providers: [ { provide: CalendarDateFormatter, useClass: CalendarMomentDateFormatter, }, ],
Thanks @rmonteroh, you actually pointed me to the solution! My custom CalendarDateFormatter
was using the Angular formatDate
, while I had to change it using moment
.
So like:
import * as moment from 'moment-timezone';
public dayViewHour({ date, locale }: DateFormatterParams): string {
return moment(date).format('HH:mm');
}
Now the calendar displays the right day and it always starts from 00:00, no matter the computer timezone
Just ran into the same issue and @ghidoz 's solution was what fixed it for me.
So, I don't think this is a bug, but the example for making custom date adaptors should have some sort of warning that this sort of thing is possible and that you need to use the moment version instead of the standard one if using moment elsewhere.
Describe the bug I am using an angular calendar with moment js and when defining the default time zone of moment
moment.tz.setDefault('America/New_York');
in some cases I get the calendar with the wrong dates and it even starts on Saturday when it should start on SundayMinimal reproduction of the problem with instructions Define a different time zone for moment than the one you have locally, ex
moment.tz.setDefault('America/New_York');
Screenshots
Versions
@angular/core
: 12.0.5angular-calendar
: ^0.28.22