1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +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:
Linus Groh 2020-03-30 00:21:56 +01:00 committed by Andreas Kling
parent 5c779c124b
commit d4e3688f4f
25 changed files with 567 additions and 5 deletions

View 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);
}