Skip to content

Commit

Permalink
Merge pull request #41 from AlecM33/time-zone
Browse files Browse the repository at this point in the history
Refactor timezone to an environment variable
  • Loading branch information
AlecM33 authored Sep 2, 2024
2 parents 5aece86 + da15dae commit 99b2f4c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/command-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ module.exports = {
', ' + new Date((game.gameDate || game.datetime?.dateTime || game.gameData?.datetime?.dateTime)).toLocaleString('default', {
month: 'short',
day: 'numeric',
timeZone: 'America/New_York',
timeZone: (process.env.TIME_ZONE.trim() || 'America/New_York'),
hour: 'numeric',
minute: '2-digit',
timeZoneName: 'short'
Expand Down Expand Up @@ -931,7 +931,7 @@ async function resolveDoubleHeaderSelection (interaction) {
new ButtonBuilder()
.setCustomId(game.gamePk.toString())
.setLabel(new Date(game.gameDate).toLocaleString('en-US', {
timeZone: 'America/New_York',
timeZone: (process.env.TIME_ZONE.trim() || 'America/New_York'),
hour: 'numeric',
minute: '2-digit',
timeZoneName: 'short'
Expand Down
4 changes: 2 additions & 2 deletions modules/interaction-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = {
reply += date.date.substr(6) +
(home ? ' vs. ' : ' @ ') + (home ? teams.away.team.name : teams.home.team.name) + ' ' +
gameDate.toLocaleString('en-US', {
timeZone: 'America/New_York',
timeZone: (process.env.TIME_ZONE.trim() || 'America/New_York'),
hour: 'numeric',
minute: '2-digit',
timeZoneName: 'short'
Expand Down Expand Up @@ -315,7 +315,7 @@ module.exports = {
', ' + new Date(game.gameDate).toLocaleString('default', {
month: 'short',
day: 'numeric',
timeZone: 'America/New_York',
timeZone: (process.env.TIME_ZONE.trim() || 'America/New_York'),
hour: 'numeric',
minute: '2-digit',
timeZoneName: 'short'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "main.js",
"scripts": {
"test": "jasmine",
"start": "NODE_ENV=production && node main.js",
"start": "NODE_ENV=production && node deploy-commands.js && node main.js",
"heroku-postbuild": "mkdir ./.cache && mv /app/.cache/puppeteer ./.cache"
},
"author": "",
Expand Down

0 comments on commit 99b2f4c

Please sign in to comment.