You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function added to Array prototype cause conflict with "for( var in ) " statement. So please change the way this function is working, my suggestion is
function dtp_toDate(thisarray, type) {
var splitter = '-';
if (/invalid/i.test(new Date('1991-9-12')))
splitter = '/';
var date = thisarray.join(splitter);
if (thisarray.length == 5)
date = thisarray.slice(0,3).join(splitter) +' '+ thisarray.slice(3,5).join(':')
if (!type) return date;
date = new Date(date);
if (type == 'unix')
return date.getTime();
return date;
};
function Array2Number(thisarray) {
return thisarray.map(function(item) {return Number(item);});
};
of course the call to the function should be changed as well
The function added to Array prototype cause conflict with "for( var in ) " statement. So please change the way this function is working, my suggestion is
remove these functions
Array.prototype.toNumber
Array.prototype.dtp_toDate
and add the following
of course the call to the function should be changed as well
return [this.getFullYear(), this.getMonth() + 1, this.getDate()].dtp_toDate();
=>
return dtp_toDate([this.getFullYear(), this.getMonth() + 1, this.getDate()]);
Actually adding this method to prototype does not make sense as the function is not working for any array rather only array with 3 elements (Y M D).
The text was updated successfully, but these errors were encountered: