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

From Discord: Converting Zoned DateTime to UTC in Effect Typescript #4364

Open
effect-bot opened this issue Jan 30, 2025 · 0 comments
Open

Comments

@effect-bot
Copy link

Summary

In the chat, jessekelly is trying to convert a DateTime.Zoned object to DateTime.Utc within the Effect Typescript library. They express some difficulty in finding a straightforward method for this conversion. whatthebluck suggests using DateTime.setZone, but it is not applicable for converting from a zoned time to UTC. jessekelly points out that simply calling .make on a Zoned object returns an Option<DateTime.Zoned>, not what they need.

jessedkelly explains that they need the Zoned type on the frontend for parsing user-related time expressions like "today" or "tomorrow" in the user's timezone. rjdellecese suggests extracting epochMillis from the DateTime.Zoned and manually constructing a DateTime.Utc object as a workaround.

Key Takeaways:

  • There seems to be a gap in the Effect Typescript library for easily converting a Zoned DateTime to a Utc DateTime.
  • Users discussed workarounds, like using epochMillis, but acknowledge the need for a more straightforward API for this conversion.
  • This topic is relevant to both participants as they are dealing with user-specific timezone data.

Discord thread

https://discord.com/channels/795981131316985866/1334487889160962141

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

No branches or pull requests

1 participant