Open
Description
Hi,
This adapter doesn't allow to specify a timezone when parsing/formatting dates, since, unline Luxon, date-fns
options don't support timezones. There is an official complementary library, date-fns-tz, that adds functions with timezone support:
zonedTimeToUtc
- Given a date and any time zone, returns a Date with the equivalent UTC timeutcToZonedTime
- Get a date/time representing local time in a given time zone from the UTC dategetTimezoneOffset
- Gets the offset in milliseconds between the time zone and UTC timeformat
- Extends date-fns/format with full time zone supporttoDate
- Can be used to create a zoned Date from a string containing an offset or IANA time zone
I wonder what is the best strategy to support timezones:
- Create a
chartjs-adapter-date-fns-tz
adapter that extends this one, - Or add a timezone option in this adapter, then calling
date-fns-tz
functions (I guess we should then make the dependency optional)?
Since there is no too much logic in date adapters (i.e we just pass options
to the underlying library), creating a distinct adapter may be a cleaner option?
Metadata
Metadata
Assignees
Labels
No labels