Skip to content

Commit

Permalink
Document timezone offsets in code
Browse files Browse the repository at this point in the history
  • Loading branch information
meduzen committed Apr 20, 2024
1 parent cd37ffb commit 8c9fa80
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/utils/const.js
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions types/utils/const.d.ts
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 8c9fa80

Please sign in to comment.