Skip to content
Snippets Groups Projects
Commit bcc764f9 authored by Alex Arnaud's avatar Alex Arnaud
Browse files

[RTOK] hotline#193156 : fix date format when typing manually in DTpickers

parent 7ab6b37c
Branches
1 merge request!5169[RTOK] hotline#193156 : fix date format when typing manually in DTpickers
- correctif #193156 : corrige la saisie manuelle dans les datetimepickers
\ No newline at end of file
......@@ -856,7 +856,8 @@
$(this).addClass('active');
var $picker = getParentPickerObject($(this));
var date = getPickedDate($picker);
var $inp = getPickersInputObject($picker);
date = formatDateString($picker, $inp.val());
var hour = $(this).data("hour");
var min = $(this).data("min");
draw($picker, {
......@@ -927,6 +928,17 @@
return obj !== undefined && obj !== null && clas === type;
};
var formatDateString = function($picker, date_string) {
var format = $picker.data('dateFormat');
// Do we need to do that for each available formats ?
if (format.startsWith('DD/MM/YYYY')) {
parts = date_string.split(' ')[0].split('/');
return new Date(parts[2], parts[1] -1, parts[0]);
}
return getPickedDate($picker);
};
var init = function($obj, opt) {
/* Container */
var $picker = $('<div>');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment