1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00
serenity/Userland/Libraries/LibJS/Tests/builtins/Date
Linus Groh 39cdffd78d LibJS: Make Date.now() return a floor()'d milliseconds value
It is defined as follows:

    21.4.3.1 Date.now ( )
    https://tc39.es/ecma262/#sec-date.now

    The now function returns the time value designating the UTC date and
    time of the occurrence of the call to now.

"Time value" is defined as:

    21.4.1.1 Time Values and Time Range
    https://tc39.es/ecma262/#sec-time-values-and-time-range

    An ECMAScript time value is a Number, either a finite integral
    Number representing an instant in time to millisecond precision or
    NaN representing no specific instant.

By flooring the value we match the behavior in the Temporal proposal's
Temporal.ZonedDateTime.prototype.epochMilliseconds getter:

    4. Let ms be RoundTowardsZero(ℝ(ns) / 10^6).

With that being defined as:

    13.30 RoundTowardsZero ( x )
    https://tc39.es/proposal-temporal/#sec-temporal-roundtowardszero

    1. Return the mathematical value that is the same sign as x and
    whose magnitude is floor(abs(x)).

This is makes the last of the currently 15 Temporal tests in test262
work, which compares Temporal.now.instant() with Date.now() :^)
2021-07-10 19:51:07 +01:00
..
Date.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.now.js LibJS: Make Date.now() return a floor()'d milliseconds value 2021-07-10 19:51:07 +01:00
Date.parse.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Date.prototype.getDate.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getDay.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getFullYear.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getHours.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getMilliseconds.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getMinutes.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getMonth.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getSeconds.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getTime.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCDate.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCDay.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCFullYear.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCHours.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCMilliseconds.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCMinutes.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCMonth.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.getUTCSeconds.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.setDate.js LibJS: Add Date.prototype.setDate() 2021-06-06 19:14:11 +01:00
Date.prototype.setFullYear.js LibJS: Account for differences in month representations (0-11 vs 1-12) 2021-06-06 19:14:11 +01:00
Date.prototype.setHours.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.setMilliseconds.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.setMinutes.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.setMonth.js LibJS: Add Date.prototype.setMonth() 2021-06-06 19:14:11 +01:00
Date.prototype.setSeconds.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.setTime.js LibJS: Add Date.prototype.setTime() 2021-06-06 19:14:11 +01:00
Date.prototype.toISOString.js LibJS Date: Added "Invalid Date". 2021-03-22 20:58:22 +01:00
Date.prototype.toTemporalInstant.js LibJS/Tests: Add tests for Date.prototype.toTemporalInstant() 2021-07-09 13:20:51 +01:00
Date.UTC.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00