Skip to content

Commit

Permalink
Merge pull request #1237 from visualize-admin/fix/parse-dates-with-ti…
Browse files Browse the repository at this point in the history
…mezones

fix: Dates with timezones are now correctly parsed
  • Loading branch information
bprusinowski authored Oct 31, 2023
2 parents f5218da + 205699a commit 79858fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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)
- Cubes, themes and organizations queries aren't fired anymore when previewing a dataset
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

1 comment on commit 79858fb

@vercel
Copy link

@vercel vercel bot commented on 79858fb Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-ixt1.vercel.app
visualization-tool-git-main-ixt1.vercel.app

Please sign in to comment.