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

Data.Time.LocalTime.TimeZone is not a timezone but a timezone offset #231

Closed
NorfairKing opened this issue Dec 30, 2022 · 3 comments
Closed
Milestone

Comments

@NorfairKing
Copy link

NorfairKing commented Dec 30, 2022

It would be great to:

  1. Rename TimeZone to TimeZoneOffset
  2. Have a proper TimeZone
  3. Have an api like TimeZone -> LocalTime -> TimeZoneOffset
  4. Have an api like LocalTime -> TimeZone -> [UTCTime] (because each local time could reference 0, 1, or more utc times) and UTCTime -> TimeZone -> LocalTime (all without IO)
@NorfairKing
Copy link
Author

To elaborate a bit:

localTimeToUTC is nice, but how is a user supposed to know which TimeZone (offset) is supposed to be used?
This is important because getCurrentTimeZone is likely wrong, i.e. because the local time is more than a few months away from "right now".

@AshleyYakeley
Copy link
Member

AshleyYakeley commented Jan 1, 2023

So proper time-zone functionality is #89, to copy time-zone code from the timezone-series & timezone-olson packages. This would be time version 2.0.

Rename TimeZone to TimeZoneOffset

This may or may not be worth doing. It's certainly a regret of mine, see here.

There are also other issues with the current TimeZone type.

localTimeToUTC is nice, but how is a user supposed to know which TimeZone (offset) is supposed to be used?

Currently the time library only knows about the configured time-zone. But to get the time zone offset for some particular time, you can use getTimeZone.

@AshleyYakeley AshleyYakeley added this to the 2.0 milestone Jan 1, 2023
@AshleyYakeley
Copy link
Member

Closing this as covered by #89.

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

2 participants