date.js (678B)
1 function makeTwoByte(lat1) { 2 with ({}) {} 3 var twoByte = "\u1200" + lat1; 4 ensureLinearString(twoByte); 5 return twoByte.substr(1); 6 } 7 8 function test(lat1) { 9 var twoByte = makeTwoByte(lat1); 10 11 assertEq(isLatin1(lat1), true); 12 assertEq(isLatin1(twoByte), false); 13 14 assertEq(Date.parse(lat1), Date.parse(twoByte)); 15 } 16 17 // ISO format 18 test("2014-06-06"); 19 test("2014-06-06T08:30+01:00"); 20 test("T11:59Z"); 21 22 // Non-ISO format 23 test("06 Jun 2014, 17:20:36"); 24 test("6 Jun 2014"); 25 test("Wed Nov 05 21:49:11 GMT-0800 1997"); 26 test("Jan 30 2014 2:30 PM"); 27 28 // Invalid 29 test("06 Aaa 2014, 17:20:36"); 30 test("6 Jun 10"); 31 test("2014-13-06"); 32 test("2014-06-06T08:30+99:00");