Invoke timepicker to correct format of user input, for edit schedule/timesheet

It's hoped that this will prevent possibility of user submitting invalid data
This commit is contained in:
Lance Edgar 2017-02-04 14:27:47 -06:00
parent 70a1dbf69a
commit cc7c1e162f

View file

@ -111,7 +111,14 @@ $(function() {
text: "Update", text: "Update",
click: function() { click: function() {
// TODO: need to validate times here... // TODO: is this hacky? invoking timepicker to format the time values
// in all cases, to avoid "invalid format" from user input
editor.find('.shifts .shift').each(function() {
var start_time = $(this).children('input[name|="edit_start_time"]');
var end_time = $(this).children('input[name|="edit_end_time"]');
$.timepicker._setTime(start_time.data('timepicker'), start_time.val());
$.timepicker._setTime(end_time.data('timepicker'), end_time.val());
});
// create / update shifts in time table, as needed // create / update shifts in time table, as needed
editor.find('.shifts .shift').each(function() { editor.find('.shifts .shift').each(function() {