diff options
Diffstat (limited to 'stdlib/source/lux/time/instant.lux')
-rw-r--r-- | stdlib/source/lux/time/instant.lux | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 334b05115..22d57a06e 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -192,7 +192,7 @@ day-time])) ## Based on this: https://stackoverflow.com/a/42936293/6823464 -(def: (encode instant) +(def: #export (to-text instant) (-> Instant Text) (let [[[year month day] day-time] (extract-date instant) day-time (if (duration/>= duration.empty day-time) @@ -200,8 +200,7 @@ (duration.merge duration.day day-time)) [hours day-time] [(duration.query duration.hour day-time) (duration.frame duration.hour day-time)] [minutes day-time] [(duration.query duration.minute day-time) (duration.frame duration.minute day-time)] - [seconds millis] [(duration.query duration.second day-time) (duration.frame duration.second day-time)] - ] + [seconds millis] [(duration.query duration.second day-time) (duration.frame duration.second day-time)]] ($_ text/compose (int/encode year) "-" (pad month) "-" (pad day) "T" (pad hours) ":" (pad minutes) ":" (pad seconds) (|> millis @@ -299,13 +298,13 @@ (-> Text (e.Error Instant)) (l.run input lex-instant)) -(struct: #export _ - {#.doc "Based on ISO 8601. +## (struct: #export _ +## {#.doc "Based on ISO 8601. - For example: 2017-01-15T21:14:51.827Z"} - (Codec Text Instant) - (def: encode encode) - (def: decode decode)) +## For example: 2017-01-15T21:14:51.827Z"} +## (Codec Text Instant) +## (def: encode encode) +## (def: decode decode)) (def: #export now (IO Instant) |