1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 19:07:34 +00:00
serenity/Libraries/LibJS/Tests/builtins/Date
Nico Weber 5f595e7e1b LibC: Make localtime() and gmtime() handle years before 1970
Year computation has to be based on seconds, not days, in case
t is < 0 but t / __seconds_per_day is 0.

Year computation also has to consider negative timestamps.

With this, days is always positive and <= the number of days in the
year, so base the tm_wday computation directly on the timestamp,
and do it first, before t is modified in the year computation.
In C, % can return a negative number if the left operand is negative,
compensate for that.

Tested via test-js. (Except for tm_wday, since we don't implement
Date.prototype.getUTCDate() yet.)
2020-08-23 10:42:37 +02:00
..
Date.js LibJS: Implement Date's string constructor 2020-08-21 21:12:54 +02:00
Date.now.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.parse.js LibJS: Enable Date.parse.js tests that pass after c399caf27f 2020-08-23 10:42:37 +02:00
Date.prototype.getDate.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getDay.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getFullYear.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getHours.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getMilliseconds.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getMinutes.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getMonth.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getSeconds.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.getTime.js LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date.prototype.toISOString.js LibC: Make localtime() and gmtime() handle years before 1970 2020-08-23 10:42:37 +02:00
Date.UTC.js LibC: Make mktime() and timegm() handle years before 1970 2020-08-22 10:53:33 +02:00