From b41b8ef29cbc74a036eb994364ee4b25d45b261f Mon Sep 17 00:00:00 2001 From: Jan Novak Date: Thu, 7 May 2026 14:12:34 +0200 Subject: [PATCH] fix(go/fio): accept 2-digit year format in transparent date parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fio's transparent account page now serves dates as DD.MM.YY (e.g. 07.05.26) rather than the previously expected 4-digit-year format. Extends parseCzechDate to try all eight layout variants: padded and non-padded, dot and slash separators, 4-digit and 2-digit years. Go maps 2-digit year 00-68 → 2000-2068, so 26 → 2026. Co-Authored-By: Claude Opus 4.7 --- go/internal/io/fio/fio_test.go | 3 +++ go/internal/io/fio/transparent.go | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/go/internal/io/fio/fio_test.go b/go/internal/io/fio/fio_test.go index 7a3e38c..84d0281 100644 --- a/go/internal/io/fio/fio_test.go +++ b/go/internal/io/fio/fio_test.go @@ -97,6 +97,9 @@ func TestParseCzechDate(t *testing.T) { {"10/04/2026", "2026-04-10"}, {"7.5.2026", "2026-05-07"}, // non-padded — real Fio transparent page format {"3.12.2025", "2025-12-03"}, // non-padded single-digit day, double-digit month + {"07.05.26", "2026-05-07"}, // padded 2-digit year — current Fio transparent page format + {"7.5.26", "2026-05-07"}, // non-padded 2-digit year + {"07/05/26", "2026-05-07"}, // slash variant {"", ""}, {"invalid", ""}, } diff --git a/go/internal/io/fio/transparent.go b/go/internal/io/fio/transparent.go index ff47e08..31184d7 100644 --- a/go/internal/io/fio/transparent.go +++ b/go/internal/io/fio/transparent.go @@ -209,7 +209,10 @@ func hasClass(t ghtml.Token, cls string) bool { // Returns "" on parse error. func parseCzechDate(s string) string { s = strings.TrimSpace(s) - for _, layout := range []string{"2.1.2006", "02.01.2006", "2/1/2006", "02/01/2006"} { + for _, layout := range []string{ + "2.1.2006", "02.01.2006", "2/1/2006", "02/01/2006", + "2.1.06", "02.01.06", "2/1/06", "02/01/06", + } { if t, err := time.Parse(layout, s); err == nil { return t.Format("2006-01-02") }