Fix timezone display issues with formatted dates

Fixes #88

Also update Deno, hoping it might help with #87, but it's unlikely
This commit is contained in:
Bruno Bernardino
2025-08-21 17:09:32 +01:00
parent 8ff0a434fd
commit 4864c283b7
11 changed files with 68 additions and 14 deletions

View File

@@ -13,10 +13,17 @@ export default function ListExpenses(
onClickEditExpense,
}: ListExpensesProps,
) {
const dateFormat = new Intl.DateTimeFormat('en-US', {
const dateFormatOptions: Intl.DateTimeFormatOptions = {
month: 'short',
day: 'numeric',
});
};
// Force timeZone to UTC for the server rendering
if (typeof window === 'undefined') {
dateFormatOptions.timeZone = 'UTC';
}
const dateFormat = new Intl.DateTimeFormat('en-US', dateFormatOptions);
return (
<section class='mx-auto max-w-7xl my-8 mt-12'>

View File

@@ -63,7 +63,18 @@ export default function MainExpenses({ initialBudgets, initialExpenses, initialM
const shouldResetBudgetModal = useSignal<boolean>(false);
const searchTimeout = useSignal<ReturnType<typeof setTimeout>>(0);
const dateFormat = new Intl.DateTimeFormat('en-GB', { year: 'numeric', month: 'long' });
const dateFormatOptions: Intl.DateTimeFormatOptions = {
year: 'numeric',
month: 'long',
};
// Force timeZone to UTC for the server rendering
if (typeof window === 'undefined') {
dateFormatOptions.timeZone = 'UTC';
}
const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions);
const thisMonth = new Date().toISOString().substring(0, 7);
function onClickImportFile() {