Skip to content

Commit 3b625db

Browse files
committed
Add timezone setting to api
1 parent 00ed007 commit 3b625db

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

api/.env.docker.example

+1
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ MI_STRIPE_SESSION_EXPIRE_AT=82800
3535
3636
MI_RECAPTCHA_SECRET=RECAPTCHA_SECRET
3737
MI_WEBSITE_NAME="Movin' In"
38+
MI_TIMEZONE=UTC

api/.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ MI_STRIPE_SESSION_EXPIRE_AT=82800
3535
MI_ADMIN_EMAIL=[email protected]
3636
MI_RECAPTCHA_SECRET=RECAPTCHA_SECRET
3737
MI_WEBSITE_NAME="Movin' In"
38+
MI_TIMEZONE=UTC

api/src/config/env.config.ts

+9
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,15 @@ export const MINIMUM_AGE = Number.parseInt(__env__('MI_MINIMUM_AGE', false, '21'
293293
*/
294294
export const EXPO_ACCESS_TOKEN = __env__('MI_EXPO_ACCESS_TOKEN', false)
295295

296+
/**
297+
* Timezone for cenverting dates from UTC to local time.
298+
* Must be a valid TZ idenfidier: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
299+
* Default is UTC.
300+
*
301+
* @type {string}
302+
*/
303+
export const TIMEZONE = __env__('MI_TIMEZONE', false, 'UTC')
304+
296305
/**
297306
* Stripe secret key.
298307
*

api/src/controllers/bookingController.ts

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export const confirm = async (user: env.User, booking: env.Booking, payLater: bo
109109
day: 'numeric',
110110
hour: 'numeric',
111111
minute: 'numeric',
112+
timeZone: env.TIMEZONE,
112113
}
113114
const from = booking.from.toLocaleString(locale, options)
114115
const to = booking.to.toLocaleString(locale, options)

api/src/lang/en.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const en = {
2525
BOOKING_CONFIRMED_PART3: ' Please present yourself to our agency ',
2626
BOOKING_CONFIRMED_PART4: ' ',
2727
BOOKING_CONFIRMED_PART5: ' on ',
28-
BOOKING_CONFIRMED_PART6: ' (local time) to pick up your keys ',
28+
BOOKING_CONFIRMED_PART6: ` (${env.TIMEZONE}) to pick up your keys `,
2929
BOOKING_CONFIRMED_PART7: '.',
3030
BOOKING_CONFIRMED_ADDRESS: 'Property Address: ',
3131
BOOKING_CONFIRMED_MAP_PART1: 'Map Link: ',

api/src/lang/fr.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const fr = {
2525
BOOKING_CONFIRMED_PART3: ' Veuillez vous rendre à notre agence ',
2626
BOOKING_CONFIRMED_PART4: ' ',
2727
BOOKING_CONFIRMED_PART5: ' le ',
28-
BOOKING_CONFIRMED_PART6: ' (heure locale) pour récupérer vos clés ',
28+
BOOKING_CONFIRMED_PART6: ` (${env.TIMEZONE}) pour récupérer vos clés `,
2929
BOOKING_CONFIRMED_PART7: '.',
3030
BOOKING_CONFIRMED_ADDRESS: 'Adresse de la propriété: ',
3131
BOOKING_CONFIRMED_MAP_PART1: 'Lien sur la carte : ',

0 commit comments

Comments
 (0)