Changeset 165667 in webkit
- Timestamp:
- Mar 14, 2014 6:11:16 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r165656 r165667 1 2014-03-14 Byungseon Shin <sun.shin@lge.com> 2 3 Incorrect Date returned between March 1, 2034 and February 28, 2100. 4 https://bugs.webkit.org/show_bug.cgi?id=130123 5 6 Reviewed by Mark Lam. 7 8 Fix logic by using predefined Date APIs. 9 10 * js/date-constructor-expected.txt: 11 * js/script-tests/date-constructor.js: 12 (testDate): 13 1 14 2014-03-14 James Craig <jcraig@apple.com> 2 15 -
trunk/LayoutTests/js/date-constructor-expected.txt
r164373 r165667 36 36 PASS testStr is "1234567" 37 37 PASS testStr is "1234567" 38 PASS leapTestResult is true 38 39 PASS successfullyParsed is true 39 40 -
trunk/LayoutTests/js/script-tests/date-constructor.js
r164373 r165667 69 69 Date.UTC(year, month, date, hours, minutes, seconds, ms); 70 70 shouldBe('testStr', '\"1234567\"'); 71 72 // Regression test for Bug 130123 (https://bugs.webkit.org/show_bug.cgi?id=130123) 73 var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; 74 75 function testDate(year, month, date) { 76 var success = true; 77 var dateString = monthNames[month] + " " + date + ", " + year; 78 var dateObj = new Date(dateString); 79 80 if (dateObj.getFullYear() != year) { 81 shouldBe("new Date(" + dateString + ").getFullYear()", year); 82 success = false; 83 } if (dateObj.getMonth() != month) { 84 shouldBe("new Date(" + dateString + ").getMonth()", month); 85 success = false; 86 } if (dateObj.getDate() != date) { 87 shouldBe("new Date(" + dateString + ").getDate()", date); 88 success = false; 89 } 90 return success; 91 } 92 93 var leapTestResult = true; 94 var year = 100; 95 var month = 0; 96 var date = 1; 97 98 while (year < 10000) { 99 leapTestResult = leapTestResult && testDate(year, month, date); 100 year += 1; 101 month = (month + 7) % 12; 102 date = (date + 13) % 28 + 1; 103 } 104 105 shouldBeTrue("leapTestResult"); -
trunk/Source/WTF/ChangeLog
r165607 r165667 1 2014-03-14 Byungseon Shin <sun.shin@lge.com> 2 3 Incorrect Date returned between March 1, 2034 and February 28, 2100. 4 https://bugs.webkit.org/show_bug.cgi?id=130123 5 6 Reviewed by Mark Lam. 7 8 Fix logic by using predefined Date APIs. 9 10 * wtf/DateMath.cpp: 11 (WTF::ymdhmsToSeconds): 12 1 13 2014-03-12 Sergio Villar Senin <svillar@igalia.com> 2 14 -
trunk/Source/WTF/wtf/DateMath.cpp
r161601 r165667 518 518 static inline double ymdhmsToSeconds(int year, long mon, long day, long hour, long minute, double second) 519 519 { 520 double days = (day - 32075) 521 + floor(1461 * (year + 4800.0 + (mon - 14) / 12) / 4) 522 + 367 * (mon - 2 - (mon - 14) / 12 * 12) / 12 523 - floor(3 * ((year + 4900.0 + (mon - 14) / 12) / 100) / 4) 524 - 2440588; 525 return ((days * hoursPerDay + hour) * minutesPerHour + minute) * secondsPerMinute + second; 520 int mday = firstDayOfMonth[isLeapYear(year)][mon - 1]; 521 double ydays = daysFrom1970ToYear(year); 522 523 return (second + minute * secondsPerMinute + hour * secondsPerHour + (mday + day - 1 + ydays) * secondsPerDay); 526 524 } 527 525
Note: See TracChangeset
for help on using the changeset viewer.