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

Cleaner handling of timezones #27

Open
avh4 opened this issue Jul 29, 2017 · 2 comments
Open

Cleaner handling of timezones #27

avh4 opened this issue Jul 29, 2017 · 2 comments
Assignees

Comments

@avh4
Copy link
Collaborator

avh4 commented Jul 29, 2017

(Split from #25)

This is mainly a problem because Elm core does not properly support timezones or even give a way to determine the timezone of a Date value.

Specifically, in our app, we need to let the user choose moments in time, but we want the datepicker to show them dates in their user-selected timezone, which sometimes is different from the timezone of the local computer they are using.

Our investigation has led to the following thoughts about how to make datetimepicker more robust w/r to timezone handling:

  • datetimepicker should provide its own data types that directly matches what the pickers can choose
    (instead of giving back a Maybe Date)
    • datepicker should give a record with year, month, day
    • timepicker should give a record with hour, minute
    • datetimepicker should give a record with year, month, day, hour, minute
  • datetimepicker can provide convenience functions to turn the above data types into Date values (documented to note that they will convert using the local timezone of the user's web browser)
@abadi199
Copy link
Owner

abadi199 commented Aug 2, 2017

I really like the idea of datetimepicker returning its own data types. I know there's some efforts in elm-core to improve the Date API, if you know any insight of that, maybe we can try to match the API there so when the new Date API is released, we can easily swap the data types with the new core Date type.
But if it's still too early for that, I'm fine with designing our own data types.

@avh4
Copy link
Collaborator Author

avh4 commented Aug 2, 2017

I think nothing will be changing in core w/r to dates in Elm 0.19. I believe Evan thinks that it will be best to have core be a simple as possible w/r to dates and have a separate elm-lang/time package that is smart enough to include timezone info, etc. I think it's far enough out that it's worth making types here for now.

Probably will have a PR for this next week.

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

No branches or pull requests

2 participants