Skip to content

Commit

Permalink
Merge pull request #230 from seanmorley15/development
Browse files Browse the repository at this point in the history
chore: Update time zone handling in code
  • Loading branch information
seanmorley15 authored Aug 17, 2024
2 parents ff27ff3 + 2b16712 commit 0214861
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion backend/server/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/New_York'
TIME_ZONE = 'UTC'

USE_I18N = True

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/AdventureCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
{#if adventure.date && adventure.date !== ''}
<div class="inline-flex items-center">
<Calendar class="w-5 h-5 mr-1" />
<p>{new Date(adventure.date).toLocaleDateString('en-US', { timeZone: 'UTC' })}</p>
<p>{new Date(adventure.date).toLocaleDateString(undefined, { timeZone: 'UTC' })}</p>
</div>
{/if}
{#if adventure.activity_types && adventure.activity_types.length > 0}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/ChecklistCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{#if checklist.date && checklist.date !== ''}
<div class="inline-flex items-center">
<Calendar class="w-5 h-5 mr-1" />
<p>{new Date(checklist.date).toLocaleDateString('en-US', { timeZone: 'UTC' })}</p>
<p>{new Date(checklist.date).toLocaleDateString(undefined, { timeZone: 'UTC' })}</p>
</div>
{/if}
<div class="card-actions justify-end">
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/lib/components/CollectionCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@
<p>{collection.adventures.length} Adventures</p>
{#if collection.start_date && collection.end_date}
<p>
Dates: {new Date(collection.start_date).toLocaleDateString('en-US', { timeZone: 'UTC' })} - {new Date(
collection.end_date
).toLocaleDateString('en-US', { timeZone: 'UTC' })}
Dates: {new Date(collection.start_date).toLocaleDateString(undefined, { timeZone: 'UTC' })} -
{new Date(collection.end_date).toLocaleDateString(undefined, { timeZone: 'UTC' })}
</p>
<!-- display the duration in days -->
<p>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/NoteCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
{#if note.date && note.date !== ''}
<div class="inline-flex items-center">
<Calendar class="w-5 h-5 mr-1" />
<p>{new Date(note.date).toLocaleDateString('en-US', { timeZone: 'UTC' })}</p>
<p>{new Date(note.date).toLocaleDateString(undefined, { timeZone: 'UTC' })}</p>
</div>
{/if}
<div class="card-actions justify-end">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/TransportationCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</p>
{/if}
{#if transportation.date}
{new Date(transportation.date).toLocaleString()}
{new Date(transportation.date).toLocaleString(undefined, { timeZone: 'UTC' })}
{/if}
{#if user?.pk === transportation.user_id}
<div class="card-actions justify-end">
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/routes/adventures/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@
<path d="M3 10h18"></path>
</svg>
<span class="text-sm text-muted-foreground"
>{new Date(adventure.date).toLocaleDateString()}</span
>{new Date(adventure.date).toLocaleDateString(undefined, {
timeZone: 'UTC'
})}</span
>
</div>
{/if}
Expand Down Expand Up @@ -309,7 +311,7 @@
</p>
<p>
{adventure.date
? new Date(adventure.date).toLocaleDateString('en-US', {
? new Date(adventure.date).toLocaleDateString(undefined, {
timeZone: 'UTC'
})
: ''}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/routes/collections/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,9 @@
<p class="text-center text-lg pl-16 pr-16">Duration: {numberOfDays} days</p>
{/if}
<p class="text-center text-lg pl-16 pr-16">
Dates: {new Date(collection.start_date).toLocaleDateString('en-US', { timeZone: 'UTC' })} - {new Date(
Dates: {new Date(collection.start_date).toLocaleDateString(undefined, { timeZone: 'UTC' })} - {new Date(
collection.end_date
).toLocaleDateString('en-US', { timeZone: 'UTC' })}
).toLocaleDateString(undefined, { timeZone: 'UTC' })}
</p>

{#each Array(numberOfDays) as _, i}
Expand All @@ -539,7 +539,7 @@
)[dateString]}

<h2 class="text-center font-semibold text-2xl mb-2 mt-4">
Day {i + 1} - {currentDate.toLocaleDateString('en-US', { timeZone: 'UTC' })}
Day {i + 1} - {currentDate.toLocaleDateString(undefined, { timeZone: 'UTC' })}
</h2>
<div class="flex flex-wrap gap-4 mr-4 justify-center content-center">
{#if dayAdventures.length > 0}
Expand Down Expand Up @@ -626,7 +626,7 @@
</p>
<p>
{adventure.date
? new Date(adventure.date).toLocaleDateString('en-US', { timeZone: 'UTC' })
? new Date(adventure.date).toLocaleDateString(undefined, { timeZone: 'UTC' })
: ''}
</p>
</Popup>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/routes/profile/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
<p class="ml-1 text-lg text-center mt-4">Member Since</p>
<div class="flex items-center justify-center text-center">
<iconify-icon icon="mdi:calendar" class="text-2xl"></iconify-icon>
<p class="ml-1 text-xl">{new Date(data.user.date_joined).toLocaleDateString()}</p>
<p class="ml-1 text-xl">
{new Date(data.user.date_joined).toLocaleDateString(undefined, { timeZone: 'UTC' })}
</p>
</div>
{/if}

Expand Down

0 comments on commit 0214861

Please sign in to comment.