fix: Update timezone on the interim create page (#4262)

* Fix: Update timezone on the interim create page

The interim creation screen will set the timezone to the timezone of
the browser.  Unfortunately, the UI element was never refreshed, so
it remained on its loaded default, thus telling the user the wrong
value.

This change adds a timezone widget refresh to the end of the function that
loads the browser's local timezone into the timezone value.

This change also adds code to update the 'Local timezone' help text
for the start time and end time input bozes to
call out the selected timezone specifically.

Fixes #3898

* Fix: Change var to const for code review
This commit is contained in:
Mark Donnelly 2022-07-26 13:16:14 -04:00 committed by GitHub
parent a5f27b0a5b
commit 109c646450
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -185,6 +185,8 @@ const interimRequest = (function() {
.length > 0) {
$('#id_time_zone')
.val(tzname);
$('#id_time_zone')
.trigger('change');
}
}
},
@ -231,10 +233,14 @@ const interimRequest = (function() {
},
timezoneChange: function () {
const tzname = $(this).val();
$("input[name$='-time']")
.trigger('blur');
$("input[name$='-end_time']")
.trigger('change');
$('input[type="text"][name*="time"]').next().each(function(){
this.innerText = "Time in the " + tzname + " time zone";
});
},
toggleLocation: function () {
@ -268,4 +274,4 @@ const interimRequest = (function() {
$(function () {
'use strict';
$('#interim-request-form').each(interimRequest.init);
});
});