diff --git a/web/src/utils.ts b/web/src/utils.ts index 5713acb44..369c5a757 100644 --- a/web/src/utils.ts +++ b/web/src/utils.ts @@ -97,6 +97,10 @@ export function dateTimeLocal(date: Date): string { // milliseconds, which the input field doesn't like (on chrome, on firefox its fine) // On chrome, setting .valueAsNumber works, but that causes an error on firefox, so go // figure. - const parts = date.toISOString().split(":"); + // Additionally, toISOString always returns the date without timezone, which we would like + // to include for better usability + const tzOffset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds + const localISOTime = new Date(date.getTime() - tzOffset).toISOString().slice(0, -1); + const parts = localISOTime.split(":"); return `${parts[0]}:${parts[1]}`; }