You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Time.getZoneName in ie11 results in an invalid state for ZoneName. Instead of falling back to the timezone offset, it holds undefined in the Name variant.
The kernel code seems to expect a failure when Intl isn't fully supported, but ie11 just gives undefined.
var name = __Time_Name(Intl.DateTimeFormat().resolvedOptions().timeZone); results in __Time_Name(undefined) rather than throwing an exception which could be caught and used to find an offset.
module Main exposing (main)
import Browser
import Html exposing (Html, div, span, text)
import Time exposing (ZoneName(..))
import Task
type alias Model =
Maybe ZoneName
initialModel : () -> (Model, Cmd Msg)
initialModel () =
(Nothing, Task.perform Zone Time.getZoneName)
type Msg
= Zone ZoneName
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
Zone zone ->
(Just zone, Cmd.none)
view : Model -> Html Msg
view model =
div []
[ span []
[ case model of
Just (Name zoneName) ->
text ("Timezone name: [" ++ zoneName ++ "]")
Just (Offset offset) ->
text ("Timezone offset: [" ++ String.fromInt offset ++ "]")
Nothing ->
text "no timezone result"
]
]
main : Program () Model Msg
main =
Browser.element
{ init = initialModel
, view = view
, update = update
, subscriptions = always Sub.none
}
The text was updated successfully, but these errors were encountered:
Using
Time.getZoneName
in ie11 results in an invalid state forZoneName
. Instead of falling back to the timezone offset, it holds undefined in theName
variant.The kernel code seems to expect a failure when Intl isn't fully supported, but ie11 just gives undefined.
var name = __Time_Name(Intl.DateTimeFormat().resolvedOptions().timeZone);
results in__Time_Name(undefined)
rather than throwing an exception which could be caught and used to find an offset.SSCCE ellie gist
raw:
The text was updated successfully, but these errors were encountered: