RESOLVED FIXED Bug 129308
before-mar-1-1000 Incorrect date creation prior to 1 Mar 1000
https://bugs.webkit.org/show_bug.cgi?id=129308
Summary Incorrect date creation prior to 1 Mar 1000
John Wright
Reported 2014-02-25 06:45:50 PST
Creating date's prior to 1 Mar 1000 will create a date object a day too early. Here's example code: // Correct dates new Date("1 Jan 1900"); // Mon Jan 01 1900 00:00:00 GMT+0000 (GMT) new Date("1 Jan 1500"); // Mon Jan 01 1500 00:00:00 GMT+0000 (GMT) new Date("1 Jan 1001"); // Thu Jan 01 1001 00:00:00 GMT+0000 (GMT) new Date("1 Mar 1000"); // Sat Mar 01 1000 00:00:00 GMT+0000 (GMT) // In correct dates new Date("28 Feb 1000"); // Thu Feb 27 1000 00:00:00 GMT+0000 (GMT) new Date("1 Dec 988"); // Sun Nov 30 0988 00:00:00 GMT+0000 (GMT)
Attachments
Patch (4.22 KB, patch)
2014-03-24 12:00 PDT, Tibor Mészáros
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion (701.12 KB, application/zip)
2014-03-24 12:52 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2 (566.19 KB, application/zip)
2014-03-24 15:50 PDT, Build Bot
no flags
Patch v2 (4.40 KB, patch)
2014-03-25 06:39 PDT, Tibor Mészáros
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 (572.84 KB, application/zip)
2014-03-25 07:38 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion (615.18 KB, application/zip)
2014-03-25 08:00 PDT, Build Bot
no flags
Patch v3 (4.40 KB, patch)
2014-03-25 08:21 PDT, Tibor Mészáros
no flags
Archive of layout-test-results from webkit-ews-15 for mac-mountainlion-wk2 (570.92 KB, application/zip)
2014-03-25 09:17 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion (617.81 KB, application/zip)
2014-03-25 09:42 PDT, Build Bot
no flags
Tests (2.74 KB, patch)
2014-04-08 10:02 PDT, Tibor Mészáros
no flags
Patch (3.03 KB, patch)
2014-04-10 01:12 PDT, Csaba Osztrogonác
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-08 for mac-mountainlion (490.98 KB, application/zip)
2014-04-10 02:30 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 (461.80 KB, application/zip)
2014-04-10 03:09 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion (496.43 KB, application/zip)
2014-04-10 03:35 PDT, Build Bot
no flags
Patch v2 (2.81 KB, patch)
2014-04-10 07:23 PDT, Tibor Mészáros
no flags
Tibor Mészáros
Comment 1 2014-03-24 12:00:55 PDT
Created attachment 227674 [details] Patch There were a bug in the leap year check, so I fixed it, and added new test to show that it's working.
Build Bot
Comment 2 2014-03-24 12:52:48 PDT
Comment on attachment 227674 [details] Patch Attachment 227674 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5436077191987200 New failing tests: http/tests/cookies/simple-cookies-expired.html http/tests/cache/subresource-expiration-1.html sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T11.html js/dom/date-big-constructor.html js/date-parse-test.html http/tests/cache/subresource-expiration-2.html http/tests/misc/last-modified-parsing.html js/dom/date-DST-time-cusps.html js/date-parse-comments-test.html js/date-constructor.html js/date-toisostring.html js/dom/date-big-setdate.html
Build Bot
Comment 3 2014-03-24 12:52:51 PDT
Created attachment 227683 [details] Archive of layout-test-results from webkit-ews-05 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Build Bot
Comment 4 2014-03-24 15:50:51 PDT
Comment on attachment 227674 [details] Patch Attachment 227674 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/4903125974515712 New failing tests: http/tests/cookies/simple-cookies-expired.html js/date-constructor.html sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T11.html js/dom/date-big-constructor.html js/date-parse-test.html http/tests/misc/last-modified-parsing.html js/dom/date-DST-time-cusps.html js/date-parse-comments-test.html js/date-toisostring.html js/dom/date-big-setdate.html
Build Bot
Comment 5 2014-03-24 15:50:53 PDT
Created attachment 227698 [details] Archive of layout-test-results from webkit-ews-14 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-14 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Tibor Mészáros
Comment 6 2014-03-25 06:39:42 PDT
Created attachment 227745 [details] Patch v2 Fixed the time zone problem.
Build Bot
Comment 7 2014-03-25 07:37:58 PDT
Comment on attachment 227745 [details] Patch v2 Attachment 227745 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5104956688302080 New failing tests: http/tests/cookies/simple-cookies-expired.html js/date-constructor.html sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T11.html js/dom/date-big-constructor.html js/date-parse-test.html http/tests/misc/last-modified-parsing.html js/dom/date-DST-time-cusps.html js/date-parse-comments-test.html js/date-toisostring.html js/dom/date-big-setdate.html
Build Bot
Comment 8 2014-03-25 07:38:00 PDT
Created attachment 227747 [details] Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-11 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 9 2014-03-25 08:00:08 PDT
Comment on attachment 227745 [details] Patch v2 Attachment 227745 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5197840187916288 New failing tests: http/tests/cookies/simple-cookies-expired.html http/tests/cache/subresource-expiration-1.html sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T11.html js/dom/date-big-constructor.html js/date-parse-test.html http/tests/cache/subresource-expiration-2.html http/tests/misc/last-modified-parsing.html js/dom/date-DST-time-cusps.html js/date-parse-comments-test.html js/date-constructor.html js/date-toisostring.html js/dom/date-big-setdate.html
Build Bot
Comment 10 2014-03-25 08:00:11 PDT
Created attachment 227749 [details] Archive of layout-test-results from webkit-ews-05 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Tibor Mészáros
Comment 11 2014-03-25 08:21:48 PDT
Created attachment 227752 [details] Patch v3
Build Bot
Comment 12 2014-03-25 09:17:00 PDT
Comment on attachment 227752 [details] Patch v3 Attachment 227752 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5727751910719488 New failing tests: http/tests/cookies/simple-cookies-expired.html js/date-constructor.html sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T11.html js/dom/date-big-constructor.html js/date-parse-test.html http/tests/misc/last-modified-parsing.html js/dom/date-DST-time-cusps.html js/date-parse-comments-test.html js/date-toisostring.html js/dom/date-big-setdate.html
Build Bot
Comment 13 2014-03-25 09:17:03 PDT
Created attachment 227757 [details] Archive of layout-test-results from webkit-ews-15 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-15 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 14 2014-03-25 09:42:09 PDT
Comment on attachment 227752 [details] Patch v3 Attachment 227752 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5664647029981184 New failing tests: http/tests/cookies/simple-cookies-expired.html http/tests/cache/subresource-expiration-1.html sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.7_String.prototype.indexOf/S15.5.4.7_A1_T11.html js/dom/date-big-constructor.html js/date-parse-test.html http/tests/cache/subresource-expiration-2.html http/tests/misc/last-modified-parsing.html js/dom/date-DST-time-cusps.html js/date-parse-comments-test.html js/date-constructor.html js/date-toisostring.html js/dom/date-big-setdate.html
Build Bot
Comment 15 2014-03-25 09:42:12 PDT
Created attachment 227761 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Csaba Osztrogonác
Comment 16 2014-04-07 06:33:26 PDT
(In reply to comment #0) > Creating date's prior to 1 Mar 1000 will create a date object a day too early. > > Here's example code: > > > // Correct dates > new Date("1 Jan 1900"); // Mon Jan 01 1900 00:00:00 GMT+0000 (GMT) > new Date("1 Jan 1500"); // Mon Jan 01 1500 00:00:00 GMT+0000 (GMT) > new Date("1 Jan 1001"); // Thu Jan 01 1001 00:00:00 GMT+0000 (GMT) > new Date("1 Mar 1000"); // Sat Mar 01 1000 00:00:00 GMT+0000 (GMT) > > // In correct dates > new Date("28 Feb 1000"); // Thu Feb 27 1000 00:00:00 GMT+0000 (GMT) > new Date("1 Dec 988"); // Sun Nov 30 0988 00:00:00 GMT+0000 (GMT) https://trac.webkit.org/changeset/165667 fixed these failing tests too. *** This bug has been marked as a duplicate of bug 130123 ***
Csaba Osztrogonác
Comment 17 2014-04-07 06:36:11 PDT
Otherwise we could add new test cases to avoid future regressions.
Tibor Mészáros
Comment 18 2014-04-08 10:02:27 PDT
Created attachment 228847 [details] Tests The missing tests for this bug.
Darin Adler
Comment 19 2014-04-09 07:29:50 PDT
Comment on attachment 228847 [details] Tests Could you re-upload a version that correctly applies so that the EWS can run the tests?
Csaba Osztrogonác
Comment 20 2014-04-10 01:12:42 PDT
Reopening to attach new patch.
Csaba Osztrogonác
Comment 21 2014-04-10 01:12:47 PDT
Created attachment 229029 [details] Patch patch for landing
Build Bot
Comment 22 2014-04-10 02:30:26 PDT
Comment on attachment 229029 [details] Patch Attachment 229029 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/6720383478661120 New failing tests: js/date-constructor.html
Build Bot
Comment 23 2014-04-10 02:30:30 PDT
Created attachment 229037 [details] Archive of layout-test-results from webkit-ews-08 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-08 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Csaba Osztrogonác
Comment 24 2014-04-10 03:05:06 PDT
failures: FAIL new Date(Date.parse('28 Feb 1000 GMT')).toGMTString() should be Thu, 28 Feb 1000 00:00:00 GMT. Was Fri, 28 Feb 1000 00:00:00 GMT. FAIL new Date(Date.parse('1 Dec 988 GMT')).toGMTString() should be Sun, 01 Dec 0988 00:00:00 GMT. Was Mon, 01 Dec 0988 00:00:00 GMT.
Build Bot
Comment 25 2014-04-10 03:09:06 PDT
Comment on attachment 229029 [details] Patch Attachment 229029 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/5010492573614080 New failing tests: js/date-constructor.html
Build Bot
Comment 26 2014-04-10 03:09:16 PDT
Created attachment 229038 [details] Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-12 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 27 2014-04-10 03:34:56 PDT
Comment on attachment 229029 [details] Patch Attachment 229029 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/5718194736070656 New failing tests: js/date-constructor.html
Build Bot
Comment 28 2014-04-10 03:35:01 PDT
Created attachment 229039 [details] Archive of layout-test-results from webkit-ews-01 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-01 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Csaba Osztrogonác
Comment 29 2014-04-10 05:17:39 PDT
Comment on attachment 229029 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=229029&action=review > LayoutTests/js/script-tests/date-constructor.js:51 > +shouldBe("new Date(Date.parse('28 Feb 1000 GMT')).toGMTString()", "\"Thu, 28 Feb 1000 00:00:00 GMT\""); > +shouldBe("new Date(Date.parse('1 Dec 988 GMT')).toGMTString()", "\"Sun, 01 Dec 0988 00:00:00 GMT\""); > +shouldBe("new Date(Date.parse('1 Mar 1000 GMT')).toGMTString()", "\"Sat, 01 Mar 1000 00:00:00 GMT\""); It seems only the results should be updated: - 01 Mar 1000 - it is next to 28 Feb 1000, so it is friday - 01 Dec 0988 - it is monday as WebKit says now
Tibor Mészáros
Comment 30 2014-04-10 07:23:12 PDT
Created attachment 229049 [details] Patch v2 Fixed tests.
Darin Adler
Comment 31 2014-04-12 12:04:58 PDT
Comment on attachment 229049 [details] Patch v2 View in context: https://bugs.webkit.org/attachment.cgi?id=229049&action=review > LayoutTests/ChangeLog:3 > + (before-mar-1-1000) In correct date creation prior to 1 Mar 1000 incorrect spelling of incorrect here
WebKit Commit Bot
Comment 32 2014-04-12 12:34:31 PDT
Comment on attachment 229049 [details] Patch v2 Clearing flags on attachment: 229049 Committed r167184: <http://trac.webkit.org/changeset/167184>
WebKit Commit Bot
Comment 33 2014-04-12 12:34:37 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.