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

Add getZoneOffset function #24

Open
milkstork-kevin opened this issue Mar 4, 2020 · 1 comment
Open

Add getZoneOffset function #24

milkstork-kevin opened this issue Mar 4, 2020 · 1 comment

Comments

@milkstork-kevin
Copy link

I'm unable to write my own version of this function right now because the Zone type doesn't export its Zone function, but it should be as easy as:

getZoneOffset : Zone -> Int
getZoneOffset zone =
    case zone of
        Zone offset _ -> offset

It would be great if either this function was added or Zone was exposed as Zone(..)

@rlefevre
Copy link
Member

rlefevre commented Mar 4, 2020

It can be written and it has, see:
https://package.elm-lang.org/packages/justinmimbs/time-extra/latest/Time-Extra#toOffset

Note that it is not as easy as you said, because it actually depends on the time.
As noted in elm/time README:

Time Zones — A “time zone” is a bunch of data that allows you to turn POSIX time into human time. This is not just UTC-7 or UTC+3 though! Time zones are way more complicated than a simple offset!

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