This package provides functionality for working with time and strings based
on the ISO 8601 standard i.e. 2016-03-31T12:13:14.22-04:00
Model
Record representing the time. Offset is tuple representing the hour and minute ± from UTC.
Basics.Int
Offset represents the hour and minute timezone offset from UTC.
year : Time -> Basics.Int
return the year
month : Time -> Basics.Int
return the month
day : Time -> Basics.Int
return the day
hour : Time -> Basics.Int
return the hour
minute : Time -> Basics.Int
return the minute
second : Time -> Basics.Int
return the secon
millisecond : Time -> Basics.Int
return the millisecond
offset : Time -> Offset
return the offset
weekday : Time -> Time.Weekday
Returns the day of the week from the Time record
fromString : String -> Result String Time
Given an ISO 8601 compatible string, returns a Time record.
ISO8601.fromString "2016-01-01T01:30:00-04:00"
-- { year = 2016, month = 1, day = 1, hour = 1, minute = 30, second = 0, millisecond = 0, offset = -240) }
: ISO8601.Time
ISO8601.fromString "2016-11-07"
--{ year = 2016, month = 11, day = 7, hour = 0, minute = 0, second = 0, millisecond = 0, offset = 0 }
: ISO8601.Time
```
toString : Time -> String
Converts a Time record to an ISO 8601 formated string.
toTime : Time -> Basics.Int
Converts the Time to milliseconds relative to the Unix epoch: 1970-01-01T00:00:00Z
fromTime : Basics.Int -> Time
Converts the milliseconds relative to the Unix epoch to a Time record.
toPosix : Time -> Time.Posix
Converts the Time to standard Time.Posix type
fromPosix : Time.Posix -> Time
Converts the Time.Posix type to an ISO8601.Time
Note: The Time record has an offset, but not a time size. Adding or subtracting time across a daylight savings boundary will NOT adjust the offset.
diff : Time -> Time -> Basics.Int
the difference between two Time records in milliseconds
sub : Time -> Basics.Int -> Time
Subtract milliseconds from a Time records
add : Time -> Basics.Int -> Time
Add milliseconds to a Time records
decode : Json.Decode.Decoder Time
Decode an ISO8601 string from JSON