Change output date format & use <ul> for latest

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@5 eb64cd80-c68d-6f47-b6a3-0ada418499da
This commit is contained in:
fox
2022-06-13 16:34:20 +00:00
parent ba1a8ab394
commit 7dabe1dc7d
2 changed files with 10 additions and 7 deletions

View File

@@ -3,9 +3,12 @@ let compare = compare
let rfc_string date = date
let of_string (rfc : string) = rfc
let listing date = if date.edited <> "" then date.edited else date.created
let months = [|"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"|]
let pretty_date date =
try Scanf.sscanf date "%4s-%2s-%2s" (fun y m d -> Printf.sprintf "%s %s %s" y m d)
with Scanf.Scan_failure s as e -> Printf.fprintf stderr "%s for %s\n" s date; raise e
try Scanf.sscanf date "%4s-%d-%2s" (fun y m d -> Printf.sprintf "%s %s, %s" d (months.(m-1)) y)
with
| Scanf.Scan_failure s as e -> Printf.fprintf stderr "%s for %s\n" s date; raise e
| Invalid_argument _s as e -> Printf.fprintf stderr "Parsing %s" date; raise e
let now () = Unix.time () |> Unix.gmtime |>
(fun t -> Printf.sprintf "%4d-%02d-%02dT%02d:%02d:%02dZ"
(t.tm_year+1900) (t.tm_mon+1) t.tm_mday t.tm_hour t.tm_min t.tm_sec)