Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow luxon alternatives to handle timezones #506

Conversation

boris-graeff
Copy link

@boris-graeff boris-graeff commented May 18, 2022

Hi, we use date-fns on our project, so we would like to avoid having to load luxon in addition to manage the timezones.
What do you think about the possibility to define a static customRezonedDate method that allows to override the rezonedDate method.

  • date-fns-tz example
rrule.customRezonedDate = (date, timezone) => dateFnsTz.default.zonedTimeToUtc(date, timezone)`
  • moment-timezone example
rrule.customRezonedDate = (date, timezone) => {
  const formattedDate = moment(date).utc()
  return moment.tz(formattedDate,timezone).toDate()
}

It could even be an opportunity to remove the dependency to luxon since this is the only place where it is used.

@davidgoli
Copy link
Collaborator

Hi, thanks for contributing! I think this will soon no longer be necessary: #508

@boris-graeff
Copy link
Author

Amazing news ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants