mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibJS: Implement Temporal.Now
This commit is contained in:
parent
f1c3e3d71a
commit
f2c19f96f8
Notes:
github-actions[bot]
2024-11-25 12:33:55 +00:00
Author: https://github.com/trflynn89
Commit: f2c19f96f8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2557
Reviewed-by: https://github.com/shannonbooth ✅
12 changed files with 252 additions and 0 deletions
37
Libraries/LibJS/Runtime/Temporal/Now.h
Normal file
37
Libraries/LibJS/Runtime/Temporal/Now.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibCrypto/BigInt/SignedBigInteger.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
||||
class Now final : public Object {
|
||||
JS_OBJECT(Now, Object);
|
||||
GC_DECLARE_ALLOCATOR(Now);
|
||||
|
||||
public:
|
||||
virtual void initialize(Realm&) override;
|
||||
virtual ~Now() override = default;
|
||||
|
||||
private:
|
||||
explicit Now(Realm&);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(time_zone_id);
|
||||
JS_DECLARE_NATIVE_FUNCTION(instant);
|
||||
JS_DECLARE_NATIVE_FUNCTION(plain_date_time_iso);
|
||||
JS_DECLARE_NATIVE_FUNCTION(plain_date_iso);
|
||||
JS_DECLARE_NATIVE_FUNCTION(plain_time_iso);
|
||||
};
|
||||
|
||||
Crypto::SignedBigInteger system_utc_epoch_nanoseconds(VM&);
|
||||
ThrowCompletionOr<ISODateTime> system_date_time(VM&, Value temporal_time_zone_like);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue