Skip to content

Commit

Permalink
Attempt to default timezone to user's timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
MusikAnimal committed Mar 28, 2018
1 parent 7c69a0e commit 26e64f6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Resources/assets/js/events.js
Expand Up @@ -36,6 +36,17 @@ $(function () {
}
});

// Attempt to default the timezone to the user's timezone.
if ($('body').hasClass('event-new')) {
var timezome = 'UTC';
try {
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
if ($("#form_timezone option[value='" + timezone + "']").length) {
$('#form_timezone').val(timezone);
}
} catch (_error) {}
}

/**
* Populate hidden start/end datetime fields on form submission.
*/
Expand Down

0 comments on commit 26e64f6

Please sign in to comment.