Skip to content

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

@effect-bot

Description

@effect-bot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions