angular-calendar icon indicating copy to clipboard operation
angular-calendar copied to clipboard

Support Luxon date adapter and formater for variable timezone setting

Open dominikbrazdil opened this issue 2 years ago • 6 comments

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

dominikbrazdil avatar Apr 19 '23 09:04 dominikbrazdil

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

matts-bot[bot] avatar Apr 19 '23 09:04 matts-bot[bot]

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.

lino avatar Jul 06 '23 11:07 lino

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

billyjov avatar Oct 05 '23 14:10 billyjov

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

lino avatar Oct 05 '23 14:10 lino

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

dominikbrazdil avatar Oct 05 '23 14:10 dominikbrazdil

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

billyjov avatar Oct 05 '23 15:10 billyjov