elm-community / elm-time

A pure Elm date and time library.

Home Page:http://package.elm-lang.org/packages/elm-community/elm-time/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Get Timezone from TZ name

sporto opened this issue · comments

I'm not sure if this is possible currently, seems not.

Most of the time all I have a is a Timezone name coming from the database e.g. Australia/Melbourne

The function unpack wants a lot more information that I don't have.

Given that you already have functions for creating the timezone e.g. australia_melbourne (). I suppose that you can do the reverse and get a timezone by using the name.

It would be great to have a way to get aTimeZone just by using the name. e.g.
fromName "Australia/Melbourne". Is this possible already?

e.g.

fromName name
	case name of
		'Australia/Melbourne' ->
			Just (australia_melbourne ())
		...
		_ ->
			Nothing

I've added TimeZones.fromName to the latest version.

Thanks!