From 9ba7122e9f671046314a80168f5c00765c4a4e17 Mon Sep 17 00:00:00 2001 From: Henry Date: Sun, 21 Jul 2024 08:49:55 -0400 Subject: [PATCH] Ensure that the start and end days are in the convention Timezone for day array etc. --- app/javascript/shared/convention-timezone.mixin.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/javascript/shared/convention-timezone.mixin.js b/app/javascript/shared/convention-timezone.mixin.js index f84be5894..4446d9237 100644 --- a/app/javascript/shared/convention-timezone.mixin.js +++ b/app/javascript/shared/convention-timezone.mixin.js @@ -9,13 +9,18 @@ export const conventionTimezoneMixin = { conventionTimezone() { return this.currentSettings?.configs?.find(c => c.parameter === 'convention_timezone')?.parameter_value || 'UTC' }, + /* + NOTE: both the start and end days needs to be in the convention timezone. Otherwise if the users + computer's timezone is sufficiently different than the cons (like 8 or more hours) the days will + be off by one. + */ conventionStart() { const val = this.currentSettings?.configs?.find(c => c.parameter === 'convention_start_time')?.parameter_value; - return val ? DateTime.fromISO(val) : DateTime.now(); + return val ? DateTime.fromISO(val).setZone(this.conventionTimezone) : DateTime.now(); }, conventionEnd() { const val = this.currentSettings?.configs?.find(c => c.parameter === 'convention_end_time')?.parameter_value; - return val ? DateTime.fromISO(val) : DateTime.now(); + return val ? DateTime.fromISO(val).setZone(this.conventionTimezone) : DateTime.now(); }, daysArray() { let numDays = Math.ceil(this.conventionEnd.diff(this.conventionStart).as('days'));