diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex/artifact/time/date.lux | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 027ec6004..ba908f0af 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -23,14 +23,14 @@ [type [primitive (.except)]]]]) -(def: .public (pad value) +(def .public (pad value) (-> Nat Text) (if (n.< 10 value) (%.format "0" (%.nat value)) (%.nat value))) -(def: min_year +1,000) -(def: max_year +9,999) +(def min_year +1,000) +(def max_year +9,999) (exception: .public (year_is_out_of_range [year year.Year]) (exception.report @@ -41,11 +41,11 @@ (primitive .public Date date.Date - (def: .public epoch + (def .public epoch Date (abstraction date.epoch)) - (def: .public (date raw) + (def .public (date raw) (-> date.Date (Try Date)) (let [year (|> raw date.year year.value)] (if (or (i.< ..min_year year) @@ -53,24 +53,24 @@ (exception.except ..year_is_out_of_range [(date.year raw)]) {try.#Success (abstraction raw)}))) - (def: .public value + (def .public value (-> Date date.Date) (|>> representation)) - (def: .public equivalence + (def .public equivalence (Equivalence Date) (implementation - (def: (= reference subject) + (def (= reference subject) (date#= (representation reference) (representation subject))))) - (def: .public (format value) + (def .public (format value) (%.Format Date) (%.format (|> value representation date.year year.value .nat %.nat) (|> value representation date.month month.number ..pad) (|> value representation date.day_of_month ..pad))) - (def: .public parser + (def .public parser (Parser Date) (do <>.monad [year (<>.codec n.decimal (<text>.exactly 4 <text>.decimal)) |