mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +00:00
LibJS: Start implementing Date :^)
This adds: - A global Date object (with `length` property and `now` function) - The Date constructor (no arguments yet) - The Date prototype (with `get*` functions)
This commit is contained in:
parent
5c779c124b
commit
d4e3688f4f
Notes:
sideshowbarker
2024-07-19 08:03:11 +09:00
Author: https://github.com/linusg
Commit: d4e3688f4f
Pull-request: https://github.com/SerenityOS/serenity/pull/1533
Reviewed-by: https://github.com/awesomekling
25 changed files with 567 additions and 5 deletions
15
Libraries/LibJS/Tests/Date.now.js
Normal file
15
Libraries/LibJS/Tests/Date.now.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
function assert(x) { if (!x) throw 1; }
|
||||
|
||||
try {
|
||||
var last = 0;
|
||||
for (var i = 0; i < 100; ++i) {
|
||||
var now = Date.now();
|
||||
assert(!isNaN(now))
|
||||
assert(now > 1580000000000);
|
||||
assert(now >= last);
|
||||
last = now;
|
||||
}
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue