diff --git a/webapp/TargetedMS/js/scheduler.js b/webapp/TargetedMS/js/scheduler.js index f289542e2..89b1109eb 100644 --- a/webapp/TargetedMS/js/scheduler.js +++ b/webapp/TargetedMS/js/scheduler.js @@ -385,6 +385,13 @@ $(function() { }); + // Format to datetime-local's fixed 'yyyy-MM-ddTHH:mm' from local fields; DateFormat.format.date zeroes the time in timezones whose label contains a colon (e.g. Honolulu). + function toDateTimeLocalValue(date) { + let pad = function(n) { return (n < 10 ? '0' : '') + n; }; + return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate()) + + 'T' + pad(date.getHours()) + ':' + pad(date.getMinutes()); + } + function editEvent(event) { let startDate = event.startDate; let endDate = event.endDate; @@ -396,8 +403,8 @@ $(function() { endDate.setDate(endDate.getDate() - 1); } - let startDateFormatted = DateFormat.format.date(startDate, LABKEY.container.formats.dateTimeFormat); - let endDateFormatted = DateFormat.format.date(endDate, LABKEY.container.formats.dateTimeFormat); + let startDateFormatted = toDateTimeLocalValue(startDate); + let endDateFormatted = toDateTimeLocalValue(endDate); // remove the old event log rows removeEventLog();