1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00
serenity/Userland/Libraries/LibJS/Tests/builtins
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
..
AggregateError LibJS: Implement the Error Cause proposal 2021-06-11 21:34:05 +01:00
Array LibJS: Remove fast array paths in ArrayPrototype::{pop, push} 2021-07-07 21:24:26 +01:00
ArrayBuffer LibJS: ArrayBuffer.prototype.slice 2021-04-03 16:24:44 +02:00
BigInt LibJS: Tweak error message in the NumberToBigInt abstract operation 2021-07-09 13:20:51 +01:00
Boolean Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
DataView LibJS: Add tests for DataView.prototype getters and setters 2021-06-14 01:45:04 +01:00
Date LibJS: Make Date.now() return a floor()'d milliseconds value 2021-07-10 19:51:07 +01:00
Error LibJS: Implement the Error Cause proposal 2021-06-11 21:34:05 +01:00
FinalizationRegistry LibJS: Add all of the FinalizationRegistry.prototype methods 2021-06-15 23:59:21 +01:00
Function LibJS: Change non-ScriptFunction source string to "[native code]" 2021-03-14 19:22:16 +01:00
functions LibJS: Add the global escape() & unescape() methods 2021-06-05 18:55:08 +01:00
Infinity Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
JSON LibJS: Dont try to serialize symbol-keyed properties 2021-04-16 19:22:29 +02:00
Map LibJS: Add the MapIterator built-in and the key/values/entries methods 2021-06-13 00:33:18 +01:00
Math LibJS: Correctly handle mixing +0 and -0 in Math.{min,max}() 2021-04-23 20:51:48 +02:00
NaN Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Number LibJS: Add the Number.prototype.toFixed method 2021-06-19 16:13:59 +01:00
Object LibJS: Make Object.prototype.toString() fully spec compliant 2021-07-05 20:21:26 +01:00
Promise LibJS: Add @@toStringTag to Promise.prototype 2021-06-08 19:13:14 +01:00
Proxy LibJS: Fix second argument passed to Proxy [[Call]] trap (thisArgument) 2021-07-06 17:29:12 +01:00
Reflect LibJS: Rewrite most of Object for spec compliance :^) 2021-07-04 22:07:36 +01:00
RegExp LibJS: Implement RegExp.prototype.hasIndices proposal 2021-07-10 16:49:35 +01:00
Set LibJS: Add the SetIterator built-in and Set.prototype.{values, entries} 2021-06-09 11:48:04 +01:00
String LibJS: Implement RegExp.prototype [ @@split ] 2021-07-09 19:45:55 +01:00
Symbol LibJS: Unbreak test-js test that depended on function object class name 2021-06-27 22:51:39 +02:00
Temporal LibJS: Implement Temporal.Instant.fromEpochNanoseconds() 2021-07-09 13:20:51 +01:00
TypedArray LibJS: Add %TypedArray%.prototype.toLocaleString 2021-07-09 22:32:25 +01:00
WeakMap LibJS: Use undefined as the fallback value for iterable entry key/value 2021-06-12 22:34:28 +01:00
WeakRef LibJS: Add the WeakRef.prototype.deref method 2021-06-12 18:39:23 +01:00
WeakSet LibJS: Notify WeakSets when heap cells are sweeped 2021-06-09 21:52:25 +01:00