Hi,
Would it be good to save a date as timestamp instead of humanize format ? YES !
So I made a new function in the calendar.JS file :
'__unixize': function(val,anneev,moisv,jourv) {
var sdate = val;
var tmpdate = new Date();
var annee = parseInt(anneev)*1;
var mois = parseInt(moisv)-1;
var jour = parseInt(jourv)*1;
tmpdate.setFullYear(annee);
tmpdate.setMonth(mois);
tmpdate.setDate(jour);
tmpdate.setHours(0);
tmpdate.setMinutes(0);
tmpdate.setSeconds(0);
tmpdate.setMilliseconds(0);
tsdate = tmpdate.getTime()/1000;
return tsdate;
},
I have inserted it right after the '__zeroize' function.
As well, we have to add a new pattern in the pattern list :
'patterns': {
'X': '(\\d{12})',
'Y': '(\\d{4})',
'm': '(\\d{2})',
'd': '(\\d{2})',
'H': '(\\d{2})',
'i': '(\\d{2})',
's': '(\\d{2})',
'j': '(\\d+)',
'g': '(\\d+)',
'h': '(\\d+)',
'n': '(\\d+)',
'k': '(\\d+)',
'z': '(\\d+)',
'a': '([apm]+)',
'G': '(\\d+)',
'A': '([APM]+)'
},
And of course, we have to add the new format in the __exportDate function :
(I have added it in the $extend part)
$extend(
this.__map,
{
// Day of the month with leading zeros
'd': this.__zeroize(this.__map['j']),
// Numeric month with leading zeros
'm': this.__zeroize(this.__map['n']),
// 24-hour format of an hour with leading zeros
'H': this.__zeroize(this.__map['G']),
// 12-hour format of an hour with leading zeros
'h': this.__zeroize(this.__map['g']),
// Minutes with leading zeros
'i': this.__zeroize(this.__map['k']),
// Seconds with leading zeros
's': this.__zeroize(this.__map['z']),
// Uppercase AM or PM
'A': this.__map['a'].toUpperCase
// Export a timestamp formatted date
'X': this.__unixize(this.value,this.__map['Y'],this.__map['n'],this.__map['j'])
}
);</P>