]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Workaround for safari bug
authorIskren Chernev <iskren.chernev@gmail.com>
Fri, 27 Dec 2013 16:56:43 +0000 (17:56 +0100)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 28 Dec 2013 20:57:06 +0000 (12:57 -0800)
test/moment/create.js

index 7c22208edb59cac72f438dd068199d300f224c1e..6baf65f7bc1fa08e8f81b57f9a6cd9f4cdf433f4 100644 (file)
@@ -746,8 +746,12 @@ exports.create = {
         //can parse other stuff too
         test.equal(moment('1999-W37-4 3:30', 'GGGG-[W]WW-E HH:mm').format('YYYY MM DD HH:mm'), '1999 09 16 03:30', "parsing weeks and hours");
 
-        // Years less than 100
-        ver('0098-06', 'GGGG-WW', "0098 02 03", "small years work", true);
+        // In safari, all years before 1300 are shifted back with one day.
+        // http://stackoverflow.com/questions/20768975/safari-subtracts-1-day-from-dates-before-1300
+        if (new Date("1300-01-01").getUTCFullYear() === 1300) {
+            // Years less than 100
+            ver('0098-06', 'GGGG-WW', "0098 02 03", "small years work", true);
+        }
 
         test.done();
     },