-
Notifications
You must be signed in to change notification settings - Fork 21
Fix negative timestamps parsing incorrectly #32
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,7 +342,7 @@ utcOffsetInMinutes = | |
| utcOffsetMinutesFromParts : Int -> Int -> Int -> Int | ||
| utcOffsetMinutesFromParts multiplier hours minutes = | ||
| -- multiplier is either 1 or -1 (for negative UTC offsets) | ||
| multiplier * (hours * 60) + minutes | ||
| multiplier * ((hours * 60) + minutes) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The actual fix to correct the implementation. |
||
| in | ||
| Parser.succeed identity | ||
| |= oneOf | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,9 +3,9 @@ module Example exposing (knownValues, reflexive) | |
| import Expect | ||
| import Fuzz | ||
| import Iso8601 | ||
| import Json.Decode exposing (decodeString, errorToString) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Automatically sorted by |
||
| import Test exposing (..) | ||
| import Time | ||
| import Json.Decode exposing (decodeString, errorToString) | ||
|
|
||
|
|
||
| knownValues : Test | ||
|
|
@@ -99,11 +99,20 @@ knownValues = | |
| \_ -> | ||
| Iso8601.toTime "2019-05-30T06:30" | ||
| |> Expect.equal (Ok (Time.millisToPosix 1559197800000)) | ||
| , test "toTime supports negative timestamps (French Polynesia: Marquesas Islands)" <| | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| \_ -> | ||
| Iso8601.toTime "2022-11-21T00:00:00-09:30" | ||
| |> Expect.equal (Ok (Time.millisToPosix 1669023000000)) | ||
| , test "toTime supports negative timestamps (Canada: Newfoundland, Labrador (southeast))" <| | ||
| \_ -> | ||
| Iso8601.toTime "2022-11-21T00:00:00-03:30" | ||
| |> Expect.equal (Ok (Time.millisToPosix 1669001400000)) | ||
| , test "decoder returns clearer error for dead ends" <| | ||
| \_ -> | ||
| case decodeString Iso8601.decoder "2010-09-31T14:29:25.01235Z" of | ||
| Err error -> | ||
| Expect.notEqual (errorToString error) "TODO deadEndsToString" | ||
|
|
||
| Ok _ -> | ||
| Expect.fail "Should fail on dead ends" | ||
| ] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required change for the
elm-testcommand to run.