From 39c4018b3a49f354b9bb952539a944793616ff62 Mon Sep 17 00:00:00 2001 From: AlexandreDoneux <94830560+AlexandreDoneux@users.noreply.github.com> Date: Fri, 12 Jan 2024 14:10:32 +0100 Subject: [PATCH] [frontend/settings] Fixing empty datetime picker sends creation date When using viewDate to retrieve date on empty picker it sent the creation date of that picker. Using date instead. --- inginious/frontend/templates/course_admin/settings.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inginious/frontend/templates/course_admin/settings.html b/inginious/frontend/templates/course_admin/settings.html index 575dca568..897312a3a 100644 --- a/inginious/frontend/templates/course_admin/settings.html +++ b/inginious/frontend/templates/course_admin/settings.html @@ -530,9 +530,9 @@

{{_("Course settings")}}

var datetimePickerTargets = ['#accessible_start_picker', '#accessible_end_picker', '#registration_start_picker', '#registration_end_picker']; datetimePickerTargets.forEach(function(target) { - var selectedDatetime = $(target).datetimepicker('viewDate'); - var modifiedDatetime = selectedDatetime.clone().utc(); - $('[data-target="' + target + '"]').val(modifiedDatetime.format('YYYY-MM-DD HH:mm:ss')); + var selectedDatetime = $(target).datetimepicker('date'); + var modifiedDatetime = selectedDatetime !== null ? selectedDatetime.clone().utc().format('YYYY-MM-DD HH:mm:ss') : null; + $('[data-target="' + target + '"]').val(modifiedDatetime); }); this.submit();