From 48ce6fc101cea857765f86c33bc7bb9b26ba1f99 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 18 Feb 2014 10:43:23 +0000 Subject: [PATCH] add workaround for Safari 4/5 to parse dates, fixes #2329 --- source/Ox/js/Date.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/Ox/js/Date.js b/source/Ox/js/Date.js index 1a609c93..a96283e2 100644 --- a/source/Ox/js/Date.js +++ b/source/Ox/js/Date.js @@ -245,10 +245,17 @@ Ox.makeDate Takes a date, number or string, returns a date '01/01/1970' > Ox.formatDate(Ox.makeDate(new Date('01/01/1970')), '%m/%d/%Y') '01/01/1970' + > Ox.formatDate(Ox.makeDate('1970-01-01'), '%Y-%m-%d') + '1970-01-01' @*/ Ox.makeDate = function(date) { // 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 + ); }; /*@