Skip to content

Commit

Permalink
Add timezone setting to api
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Jan 24, 2025
1 parent 00ed007 commit 3b625db
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/.env.docker.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ MI_STRIPE_SESSION_EXPIRE_AT=82800
MI_ADMIN_EMAIL=admin@movinin.io
MI_RECAPTCHA_SECRET=RECAPTCHA_SECRET
MI_WEBSITE_NAME="Movin' In"
MI_TIMEZONE=UTC
1 change: 1 addition & 0 deletions api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ MI_STRIPE_SESSION_EXPIRE_AT=82800
MI_ADMIN_EMAIL=admin@movinin.io
MI_RECAPTCHA_SECRET=RECAPTCHA_SECRET
MI_WEBSITE_NAME="Movin' In"
MI_TIMEZONE=UTC
9 changes: 9 additions & 0 deletions api/src/config/env.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@ export const MINIMUM_AGE = Number.parseInt(__env__('MI_MINIMUM_AGE', false, '21'
*/
export const EXPO_ACCESS_TOKEN = __env__('MI_EXPO_ACCESS_TOKEN', false)

/**
* Timezone for cenverting dates from UTC to local time.
* Must be a valid TZ idenfidier: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
* Default is UTC.
*
* @type {string}
*/
export const TIMEZONE = __env__('MI_TIMEZONE', false, 'UTC')

/**
* Stripe secret key.
*
Expand Down
1 change: 1 addition & 0 deletions api/src/controllers/bookingController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const confirm = async (user: env.User, booking: env.Booking, payLater: bo
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
timeZone: env.TIMEZONE,
}
const from = booking.from.toLocaleString(locale, options)
const to = booking.to.toLocaleString(locale, options)
Expand Down
2 changes: 1 addition & 1 deletion api/src/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const en = {
BOOKING_CONFIRMED_PART3: ' Please present yourself to our agency ',
BOOKING_CONFIRMED_PART4: ' ',
BOOKING_CONFIRMED_PART5: ' on ',
BOOKING_CONFIRMED_PART6: ' (local time) to pick up your keys ',
BOOKING_CONFIRMED_PART6: ` (${env.TIMEZONE}) to pick up your keys `,
BOOKING_CONFIRMED_PART7: '.',
BOOKING_CONFIRMED_ADDRESS: 'Property Address: ',
BOOKING_CONFIRMED_MAP_PART1: 'Map Link: ',
Expand Down
2 changes: 1 addition & 1 deletion api/src/lang/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const fr = {
BOOKING_CONFIRMED_PART3: ' Veuillez vous rendre à notre agence ',
BOOKING_CONFIRMED_PART4: ' ',
BOOKING_CONFIRMED_PART5: ' le ',
BOOKING_CONFIRMED_PART6: ' (heure locale) pour récupérer vos clés ',
BOOKING_CONFIRMED_PART6: ` (${env.TIMEZONE}) pour récupérer vos clés `,
BOOKING_CONFIRMED_PART7: '.',
BOOKING_CONFIRMED_ADDRESS: 'Adresse de la propriété: ',
BOOKING_CONFIRMED_MAP_PART1: 'Lien sur la carte : ',
Expand Down

0 comments on commit 3b625db

Please sign in to comment.