Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Dates with timezones are now correctly parsed #1237

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion app/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
Loading