logarion-2021/lib/date.ml
orbifx 6c27c7c6fb Draft
Basic unit renamed from Note to Text.

New modular text-parser, internal to Logarion, for generic notation parsing. The default input format is now a much plainer text.

Eliminated Meta module and generally lib/ modules.

New Store interface, with additional information from Store. For example the converter can now check filesystem dates. Changed to filesystem hardlinks for tracking publications & indexing, instead of categories. New commands `publish [-i]` and `deindex [-u]`. Categories are ignored now.

Logarion created texts have part of the UUID instead of a counter in their filename. New -i, --interactive flag for interactive creation & publication.

Logarion's index re-written in Messagepack format. Removed `indices` command. They are generated during `convert`.
2021-03-31 19:14:58 +01:00

9 lines
479 B
OCaml

type t = { created: Ptime.t option; edited: Ptime.t option }
let compare = compare
let rfc_string date = match date with Some t -> Ptime.to_rfc3339 t | None -> ""
let of_string (rfc : string) = match Ptime.of_rfc3339 rfc with Ok (t,_,_) -> Some t | Error _ -> None
let listing date = if Option.is_some date.edited then date.edited else date.created
let pretty_date = function
| Some t -> Ptime.to_date t |> fun (y, m, d) -> Printf.sprintf "%04d-%02d-%02d" y m d
| None -> ""