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:
@@ -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'>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -44,14 +44,21 @@ export default function ListFiles(
|
||||
fileShareId,
|
||||
}: ListFilesProps,
|
||||
) {
|
||||
const dateFormat = new Intl.DateTimeFormat('en-GB', {
|
||||
const dateFormatOptions: Intl.DateTimeFormatOptions = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour12: false,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
};
|
||||
|
||||
// Force timeZone to UTC for the server rendering
|
||||
if (typeof window === 'undefined') {
|
||||
dateFormatOptions.timeZone = 'UTC';
|
||||
}
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions);
|
||||
|
||||
let routePath = fileShareId ? `file-share/${fileShareId}` : 'files';
|
||||
let itemSingleLabel = 'file';
|
||||
|
||||
@@ -26,14 +26,21 @@ export default function ListFiles(
|
||||
isShowingNotes,
|
||||
}: ListFilesProps,
|
||||
) {
|
||||
const dateFormat = new Intl.DateTimeFormat('en-GB', {
|
||||
const dateFormatOptions: Intl.DateTimeFormatOptions = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour12: false,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
};
|
||||
|
||||
// Force timeZone to UTC for the server rendering
|
||||
if (typeof window === 'undefined') {
|
||||
dateFormatOptions.timeZone = 'UTC';
|
||||
}
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions);
|
||||
|
||||
const routePath = isShowingNotes ? 'notes' : 'files';
|
||||
const itemSingleLabel = isShowingNotes ? 'note' : 'file';
|
||||
|
||||
@@ -13,13 +13,20 @@ export default function SearchFiles({}: SearchFilesProps) {
|
||||
const searchTimeout = useSignal<ReturnType<typeof setTimeout>>(0);
|
||||
const closeTimeout = useSignal<ReturnType<typeof setTimeout>>(0);
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat('en-GB', {
|
||||
const dateFormatOptions: Intl.DateTimeFormatOptions = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: '2-digit',
|
||||
});
|
||||
};
|
||||
|
||||
// Force timeZone to UTC for the server rendering
|
||||
if (typeof window === 'undefined') {
|
||||
dateFormatOptions.timeZone = 'UTC';
|
||||
}
|
||||
|
||||
const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions);
|
||||
|
||||
function searchFiles(searchTerm: string) {
|
||||
if (searchTimeout.value) {
|
||||
|
||||
Reference in New Issue
Block a user