Store the full year in GregorianDateTime
https://bugs.webkit.org/show_bug.cgi?id=92067
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
Use the full year instead of the offset from year 1900
for the year member variable of GregorianDateTime.
* runtime/DateConstructor.cpp:
(JSC::constructDate):
(JSC::dateUTC):
* runtime/DateConversion.cpp:
(JSC::formatDate):
(JSC::formatDateUTCVariant):
* runtime/DatePrototype.cpp:
(JSC::formatLocaleDate):
(JSC::fillStructuresUsingDateArgs):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncSetYear):
* runtime/JSDateMath.cpp:
(JSC::gregorianDateTimeToMS):
(JSC::msToGregorianDateTime):
Source/WebCore:
Use the full year instead of the offset from year 1900
for the year member variable of GregorianDateTime.
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::convertValueToQVariant):
(JSC::Bindings::convertQVariantToValue):
* bridge/qt/qt_runtime_qt4.cpp:
(JSC::Bindings::convertValueToQVariant):
(JSC::Bindings::convertQVariantToValue):
Source/WTF:
Use the full year instead of the offset from year 1900
for the year member variable of GregorianDateTime.
* wtf/GregorianDateTime.h:
(WTF::GregorianDateTime::operator tm):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/JSDateMath.cpp b/Source/JavaScriptCore/runtime/JSDateMath.cpp
index a784093..fcf1c43 100644
--- a/Source/JavaScriptCore/runtime/JSDateMath.cpp
+++ b/Source/JavaScriptCore/runtime/JSDateMath.cpp
@@ -203,7 +203,7 @@
double gregorianDateTimeToMS(ExecState* exec, const GregorianDateTime& t, double milliSeconds, bool inputIsUTC)
{
- double day = dateToDaysFrom1970(t.year() + 1900, t.month(), t.monthDay());
+ double day = dateToDaysFrom1970(t.year(), t.month(), t.monthDay());
double ms = timeToMS(t.hour(), t.minute(), t.second(), milliSeconds);
double result = (day * WTF::msPerDay) + ms;
@@ -235,7 +235,7 @@
tm.setYearDay(dayInYear(ms, year));
tm.setMonthDay(dayInMonthFromDayInYear(tm.yearDay(), isLeapYear(year)));
tm.setMonth(monthFromDayInYear(tm.yearDay(), isLeapYear(year)));
- tm.setYear(year - 1900);
+ tm.setYear(year);
tm.setIsDST(dstOff != 0.0);
tm.setUtcOffset(static_cast<long>((dstOff + utcOff) / WTF::msPerSecond));
}