mattlewis92 / angular-calendar

A flexible calendar component for angular 15.0+ that can display events on a month, week or day view.
https://mattlewis-github.com/angular-calendar/
MIT License
2.71k stars 863 forks source link

Support Luxon date adapter and formater for variable timezone setting #1661

Open dominikbrazdil opened 1 year ago

dominikbrazdil commented 1 year ago

Is your feature request related to a problem? Please describe

I need to use the calendar in different timezone from user's local one. Currently I am using Moment adapter and formatter as I was not able to implement those using date-fns-tz by myself (tried rewriting all adapter functions to work with converted Dates as described here https://github.com/marnusw/date-fns-tz/issues/67).

But MomentJS is deprecated now and increases the bundle size a lot.

Describe the solution you'd like

In our project we are thinking about using Luxon library (as direct successor of Moment) instead of date-fns-tz and it would be nice if calendar would support this out of the box without need to implement own adapter and formatter.

Describe your use case for implementing this feature

This would make timezone handling in calendar up-to-date with latest libraries and remove the hassle with painful timezone debugging

Additional context

matts-bot[bot] commented 1 year ago

Thanks so much for opening an issue! If you'd like to support this project, then please consider sponsoring me

lino commented 1 year ago

I see two tasks here.

Implementation of luxon based adapter

Possibly there is a way to do this without breaking the moment based adapters.

Deprecation of moment.js

This would possibly reduce bundle size and keep the deprecated library out of the project. Depending on if there's a way to do this without breaking, this would possibly something only applicable with a major release.

As I need to remove moment.js from a project, I'd be glad to help with achieving this.

billyjov commented 9 months ago

@lino @dominikbrazdil The current implementation already support date-fns as replacement of moment. But sure it will be nice to have support for other adapater.

lino commented 9 months ago

@lino @dominikbrazdil The current implementation already support date-fns as replacement of moment. But sure it will be nice to have support for other adapater.

Oh, I didn't realize that. It's still on my to-do list, though. Thanks for the heads up and the reminder.

dominikbrazdil commented 9 months ago

@billyjov 'date-fns' adapter does not work with different timezones than the local one (you need to use date-fns-tz library)

billyjov commented 9 months ago

@dominikbrazdil sure.. there is no support out of the box. so you have to combine date-fns and date-fns-tz