From d5c1a74dd5af1398521b2e2b58d55c9277928ab0 Mon Sep 17 00:00:00 2001 From: Julian Hurst Date: Wed, 16 Oct 2024 02:31:19 +0200 Subject: Fix locality Locality in from_str seems broken, it needs to be specified twice with %L in the layout and as a parameter. --- distamp.ha | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/distamp.ha b/distamp.ha index 1609419..fc5cf28 100644 --- a/distamp.ha +++ b/distamp.ha @@ -76,7 +76,10 @@ fn printdistamp(i: i64) void = { }; fn abs(s: str) (i64 | date::error) = { - let d = date::from_str("%Y-%m-%d %H:%M:%S", s, chrono::LOCAL)?; + // for some reason locality needs to be specified twice (hare stdlib bug?) + const stz = strings::concat(s, " Europe/Paris"); + defer free(stz); + let d = date::from_str("%Y-%m-%d %T %L", stz, chrono::tz("Europe/Paris")!)?; return time::unix(*(&d: *time::instant)); }; -- cgit v1.2.3