Make sure the browser timezone is listed before preselecting it (otherwise use UTC)
This commit is contained in:
parent
b204437473
commit
37b165f8a2
1 changed files with 3 additions and 1 deletions
|
@ -150,7 +150,9 @@ App.Pages.Booking = (function () {
|
|||
}
|
||||
});
|
||||
|
||||
$selectTimezone.val(Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC');
|
||||
const browserTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
const isTimezoneSupported = $selectTimezone.find(`option[value="${browserTimezone}"]`).length > 0;
|
||||
$selectTimezone.val(isTimezoneSupported ? browserTimezone : 'UTC');
|
||||
|
||||
// Bind the event handlers (might not be necessary every time we use this class).
|
||||
addEventListeners();
|
||||
|
|
Loading…
Reference in a new issue