Encoding/Decoding module for urbit @da representations of absolute dates, in accordance with https://urbit.org/docs/hoon/reference/auras.
Note: All dates in this format are in the UTC time zone.
Convert a DateRecord to a @da encoded string.
fromDateRecord
{ year = 2021
, month = 8
, day = 3
, hour = 6
, minute = 39
, second = 55
, millis = 356
}
--> "~2021.8.3..6.39.55..05b2"Convert a @da encoded string to a DateRecord, failing on improperly formatted strings.
toDateRecord "~2021.8.3..6.39.55..05b2"
--> Ok
--> { year = 2021
--> , month = 8
--> , day = 3
--> , hour = 6
--> , minute = 39
--> , second = 55
--> , millis = 356
--> }Convert a posix time to a @da encoded string.
import Time
Time.millisToPosix 1627948800000 |> fromPosix
--> "~2021.8.3"Try to convert a @da encoded string to a posix time, failing on improperly formatted strings.
import Time
toPosix "~2021.8.3..8.25.00"
--> Ok (Time.millisToPosix 1627979100000)Parses a @da encoded string into a DateRecord.
Parses a @da encoded string into a posix time.
An absolute date stored as a record.