fix(web): timezone handling in search filter (#7384)

This commit is contained in:
Michel Heusschen
2024-02-24 21:23:30 +01:00
committed by GitHub
parent 57758293e5
commit 6ec4c5874b
5 changed files with 29 additions and 27 deletions
+11 -7
View File
@@ -35,6 +35,7 @@
import type { Viewport } from '$lib/stores/assets.store';
import { locale } from '$lib/stores/preferences.store';
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
import { parseUtcDate } from '$lib/utils/date-time';
const MAX_ASSET_COUNT = 5000;
let { isViewing: showAssetViewer } = assetViewingStore;
@@ -143,13 +144,16 @@
isLoading = false;
};
function getHumanReadableDate(date: string) {
const d = new Date(date);
return d.toLocaleDateString($locale, {
year: 'numeric',
month: 'long',
day: 'numeric',
});
function getHumanReadableDate(dateString: string) {
const date = parseUtcDate(dateString).startOf('day');
return date.toLocaleString(
{
year: 'numeric',
month: 'long',
day: 'numeric',
},
{ locale: $locale },
);
}
function getHumanReadableSearchKey(key: keyof SearchTerms): string {