From 205699a1ec8140cba7a298d4766e7dd302a52290 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Fri, 27 Oct 2023 13:28:09 +0200 Subject: [PATCH] fix: Dates with timezones are now correctly parsed --- CHANGELOG.md | 1 + app/formatters.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bca18ba30..b712a620f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ You can also check the [release page](https://github.com/visualize-admin/visuali - Search string is now correctly persisted in search box when refreshing the page (Browse page) - Fixed issue with two queries being sent when refreshing the page when search string was entered (Browse page) - Fixed issue with filtering / unfiltering subthemes that resulted in 404 error (Browse page) + - Dates with timezones are now correctly parsed - Performance - Improved performance of searching for and retrieving datasets (Browse page) - Improved the performance of data download diff --git a/app/formatters.ts b/app/formatters.ts index 6efd49977..37e0077c6 100644 --- a/app/formatters.ts +++ b/app/formatters.ts @@ -100,14 +100,19 @@ export const dateFormatterFromDimension = ( dim.timeUnit.toLowerCase() as keyof typeof localFormatters ]; const parser = timeParse(dim.timeFormat); + const timezoneParser = timeParse(`${dim.timeFormat}%Z`); + return (d: string | null) => { if (!d) { return localFormatters.empty(); } - const parsed = parser(d); + + const parsed = parser(d) ?? timezoneParser(d); + return parsed ? formatter(parsed) : localFormatters.empty(); }; } + return formatDateAuto; };