From 8c9fa80b54295f37b316773e5e5edf2a8c0eb7a5 Mon Sep 17 00:00:00 2001 From: Mehdi M Date: Sat, 20 Apr 2024 14:49:53 +0200 Subject: [PATCH] Document timezone offsets in code --- src/utils/const.js | 16 +++++++++++++--- types/utils/const.d.ts | 9 +++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/utils/const.js b/src/utils/const.js index 5fcc57c..1889e40 100644 --- a/src/utils/const.js +++ b/src/utils/const.js @@ -1,8 +1,18 @@ export const MINUTES_PER_DAY = 60 * 24 export const MILLISECONDS_PER_DAY = 1000 * 60 * 60 * 24 export const MILLISECONDS_PER_WEEK = MILLISECONDS_PER_DAY * 7 -export const REAL_LIFE_LOWER_TIMEZONE = -12 * 60 -export const REAL_LIFE_UPPER_TIMEZONE = 14 * 60 -// Local timezone offset from UTC, in minutes +/** + * The farthest timezone offset **behind** UTC time. + */ +export const REAL_LIFE_LOWER_TIMEZONE = -12 * 60 // -12:00 + +/** + * The farthest timezone offset **ahead of** UTC time. + */ +export const REAL_LIFE_UPPER_TIMEZONE = 14 * 60 // +14:00 + +/** + * Local timezone offset from UTC, in minutes. + */ export const LOCAL_TZ_OFFSET = (new Date()).getTimezoneOffset() * -1 diff --git a/types/utils/const.d.ts b/types/utils/const.d.ts index 958d5f8..3962c4e 100644 --- a/types/utils/const.d.ts +++ b/types/utils/const.d.ts @@ -1,6 +1,15 @@ export const MINUTES_PER_DAY: number; export const MILLISECONDS_PER_DAY: number; export const MILLISECONDS_PER_WEEK: number; +/** + * The farthest timezone offset **behind** UTC time. + */ export const REAL_LIFE_LOWER_TIMEZONE: number; +/** + * The farthest timezone offset **ahead of** UTC time. + */ export const REAL_LIFE_UPPER_TIMEZONE: number; +/** + * Local timezone offset from UTC, in minutes. + */ export const LOCAL_TZ_OFFSET: number;