add workaround for Safari 4/5 to parse dates, fixes #2329

This commit is contained in:
j 2014-02-18 10:43:23 +00:00
parent 0044ffdbb3
commit 48ce6fc101

View file

@ -245,10 +245,17 @@ Ox.makeDate <f> Takes a date, number or string, returns a date
'01/01/1970' '01/01/1970'
> Ox.formatDate(Ox.makeDate(new Date('01/01/1970')), '%m/%d/%Y') > Ox.formatDate(Ox.makeDate(new Date('01/01/1970')), '%m/%d/%Y')
'01/01/1970' '01/01/1970'
> Ox.formatDate(Ox.makeDate('1970-01-01'), '%Y-%m-%d')
'1970-01-01'
@*/ @*/
Ox.makeDate = function(date) { Ox.makeDate = function(date) {
// if date is a date, new Date(date) makes a clone // if date is a date, new Date(date) makes a clone
return Ox.isUndefined(date) ? new Date() : new Date(date); return Ox.isUndefined(date) ? new Date() : new Date(
//Safari 4/5 does not understand YYYY-MM-DD format
$.browser.safari && $.browser.version <= '534.59.10' && Ox.isString(date)
? date.replace(/-/g, '/')
: date
);
}; };
/*@ /*@