bugfix: advanced search

- dates has to handle two format : the user's current and the system storage yyy-mm-dd. the system is now only handled on load ans=d converted to the user's one.
- if the date is not parsable, the fallback is now the current date.
- removal of a no more needed date setter (leaved in the comments since it may be nescessary to re-add this if the UI changes again and if the less panel has to display the dates without time 
- factorisatoin of the date/time formating into a function

SVN:trunk[5730]
This commit is contained in:
Bruno Da Silva
2018-04-24 07:25:26 +00:00
parent 4a30a875f0
commit 20def0de02

View File

@@ -117,7 +117,9 @@ $(function()
//no arrivla, the date is always formated yyy-mm-dd, we need to apply the user's formating and to write it into both the dom and the values array.
if (oInputParam.value_index in aValues && typeof aValues[oInputParam.value_index].value != 'undefined' && aValues[oInputParam.value_index].value != '')
{
var oDate = new Date(aValues[oInputParam.value_index].value);
//ie9 do not hadle the timezone like the other browsers, so wee need to make extra computation in order to be sure to obtain consistency accross browsers : we declare the date without the UTC offset (the suffix "Z", then wee add the timezone offset
var oDate = new Date(aValues[oInputParam.value_index].value.replace(' ', 'T')+'Z');
oDate.setTime(oDate.getTime() + oDate.getTimezoneOffset()*60000);//since the date was without the utc offset, we add it now
var sDate = me._formatDate(oDate);
oInputElem.val(sDate);
@@ -256,12 +258,12 @@ $(function()
},
_formatDate: function(oDate, bWithTime = true)
_formatDate: function(oDate, bWithTime)
{
var me = this;
var sLabel = $.datepicker.formatDate(me.options.datepicker.dateFormat , oDate);
if (bWithTime)
if (bWithTime === true || bWithTime === undefined)
{
sLabel = sLabel + ' ' + $.datepicker.formatTime(me.options.datepicker.timeFormat , {
hour: oDate.getHours(),