1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:07:36 +00:00

LibJS: Add the Temporal.now namespace object

This will be home to various functions:

- Temporal.now.timeZone()
- Temporal.now.instant()
- Temporal.now.plainDateTime()
- Temporal.now.plainDateTimeISO()
- Temporal.now.zonedDateTime()
- Temporal.now.zonedDateTimeISO()
- Temporal.now.plainDate()
- Temporal.now.plainDateISO()
- Temporal.now.plainTimeISO()
This commit is contained in:
Linus Groh 2021-07-06 19:33:20 +01:00
parent 8269921212
commit 7da1fcb2ef
4 changed files with 52 additions and 0 deletions

View file

@ -5,6 +5,7 @@
*/
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Temporal/Now.h>
#include <LibJS/Runtime/Temporal/Temporal.h>
namespace JS::Temporal {
@ -18,6 +19,11 @@ Temporal::Temporal(GlobalObject& global_object)
void Temporal::initialize(GlobalObject& global_object)
{
Object::initialize(global_object);
auto& vm = this->vm();
u8 attr = Attribute::Writable | Attribute::Configurable;
define_direct_property(vm.names.now, heap().allocate<Now>(global_object, global_object), attr);
}
}