diff --git a/.env.sample b/.env.sample index 6fd4106..0a501ae 100644 --- a/.env.sample +++ b/.env.sample @@ -1,4 +1,3 @@ -TZ="UTC" # optional, forces the server timezone to be UTC, which is the default, anyway PORT=8000 POSTGRESQL_HOST="postgresql" # docker container name or external hostname/IP diff --git a/components/expenses/ListExpenses.tsx b/components/expenses/ListExpenses.tsx index c9069e2..f180eb0 100644 --- a/components/expenses/ListExpenses.tsx +++ b/components/expenses/ListExpenses.tsx @@ -16,14 +16,10 @@ export default function ListExpenses( const dateFormatOptions: Intl.DateTimeFormatOptions = { month: 'short', day: 'numeric', + timeZone: 'UTC', // Expense dates are stored without timezone info, so we need to force to UTC so it's consistent across db, server, and client }; - // Force timeZone to UTC for the server rendering - if (typeof window === 'undefined') { - dateFormatOptions.timeZone = 'UTC'; - } - - const dateFormat = new Intl.DateTimeFormat('en-US', dateFormatOptions); + const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions); return (
diff --git a/components/expenses/MainExpenses.tsx b/components/expenses/MainExpenses.tsx index 09cb488..1562ef1 100644 --- a/components/expenses/MainExpenses.tsx +++ b/components/expenses/MainExpenses.tsx @@ -66,13 +66,9 @@ export default function MainExpenses({ initialBudgets, initialExpenses, initialM const dateFormatOptions: Intl.DateTimeFormatOptions = { year: 'numeric', month: 'long', + timeZone: 'UTC', // Expense dates are stored without timezone info, so we need to force to UTC so it's consistent across db, server, and client }; - // 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); diff --git a/components/files/ListFiles.tsx b/components/files/ListFiles.tsx index 6bbfa5a..18a80e4 100644 --- a/components/files/ListFiles.tsx +++ b/components/files/ListFiles.tsx @@ -53,11 +53,6 @@ export default function ListFiles( 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'; diff --git a/components/files/ListPhotos.tsx b/components/files/ListPhotos.tsx index 25ba052..0ab9660 100644 --- a/components/files/ListPhotos.tsx +++ b/components/files/ListPhotos.tsx @@ -35,11 +35,6 @@ export default function ListFiles( 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'; diff --git a/components/files/SearchFiles.tsx b/components/files/SearchFiles.tsx index fffd117..e5fa110 100644 --- a/components/files/SearchFiles.tsx +++ b/components/files/SearchFiles.tsx @@ -21,11 +21,6 @@ export default function SearchFiles({}: SearchFilesProps) { 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) { diff --git a/docker-compose.yml b/docker-compose.yml index 7e48973..9485e70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: website: - image: ghcr.io/bewcloud/bewcloud:v2.4.1 + image: ghcr.io/bewcloud/bewcloud:v2.4.2 restart: always ports: - 127.0.0.1:8000:8000 diff --git a/islands/news/Articles.tsx b/islands/news/Articles.tsx index 4f9cd33..f667a2d 100644 --- a/islands/news/Articles.tsx +++ b/islands/news/Articles.tsx @@ -24,11 +24,6 @@ export default function Articles({ initialArticles }: ArticlesProps) { const dateFormatOptions: Intl.DateTimeFormatOptions = { dateStyle: 'medium' }; - // Force timeZone to UTC for the server rendering - if (typeof window === 'undefined') { - dateFormatOptions.timeZone = 'UTC'; - } - const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions); async function refreshArticles() { diff --git a/islands/news/Feeds.tsx b/islands/news/Feeds.tsx index 6ac109d..3fa6702 100644 --- a/islands/news/Feeds.tsx +++ b/islands/news/Feeds.tsx @@ -59,11 +59,6 @@ export default function Feeds({ initialFeeds }: FeedsProps) { const dateFormatOptions: Intl.DateTimeFormatOptions = { dateStyle: 'medium', timeStyle: 'short' }; - // Force timeZone to UTC for the server rendering - if (typeof window === 'undefined') { - dateFormatOptions.timeZone = 'UTC'; - } - const dateFormat = new Intl.DateTimeFormat('en-GB', dateFormatOptions); async function onClickAddFeed() {