mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibJS: Implement the Temporal.PlainDateTime constructor
And the simple Temporal.PlainDateTime.prototype getters, so that the constructed Temporal.PlainDateTime may actually be validated.
This commit is contained in:
parent
a61cdeba24
commit
029b6ad1a8
Notes:
github-actions[bot]
2024-11-24 10:45:50 +00:00
Author: https://github.com/trflynn89
Commit: 029b6ad1a8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2544
41 changed files with 1210 additions and 13 deletions
|
@ -9,15 +9,35 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibCrypto/BigFraction/BigFraction.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/Temporal/AbstractOperations.h>
|
||||
#include <LibJS/Runtime/Temporal/ISORecords.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
||||
class PlainDateTime final : public Object {
|
||||
JS_OBJECT(PlainDateTime, Object);
|
||||
GC_DECLARE_ALLOCATOR(PlainDateTime);
|
||||
|
||||
public:
|
||||
virtual ~PlainDateTime() override = default;
|
||||
|
||||
[[nodiscard]] ISODateTime iso_date_time() const { return m_iso_date_time; }
|
||||
[[nodiscard]] String const& calendar() const { return m_calendar; }
|
||||
|
||||
private:
|
||||
PlainDateTime(ISODateTime const&, String calendar, Object& prototype);
|
||||
|
||||
ISODateTime m_iso_date_time; // [[ISODateTime]]
|
||||
String m_calendar; // [[Calendar]]
|
||||
};
|
||||
|
||||
ISODateTime combine_iso_date_and_time_record(ISODate, Time);
|
||||
bool iso_date_time_within_limits(ISODateTime);
|
||||
ThrowCompletionOr<ISODateTime> interpret_temporal_date_time_fields(VM&, StringView calendar, CalendarFields&, Overflow);
|
||||
ThrowCompletionOr<GC::Ref<PlainDateTime>> to_temporal_date_time(VM&, Value item, Value options = js_undefined());
|
||||
ISODateTime balance_iso_date_time(double year, double month, double day, double hour, double minute, double second, double millisecond, double microsecond, double nanosecond);
|
||||
ThrowCompletionOr<GC::Ref<PlainDateTime>> create_temporal_date_time(VM&, ISODateTime const&, String calendar, GC::Ptr<FunctionObject> new_target = {});
|
||||
i8 compare_iso_date_time(ISODateTime const&, ISODateTime const&);
|
||||
ThrowCompletionOr<InternalDuration> difference_iso_date_time(VM&, ISODateTime const&, ISODateTime const&, StringView calendar, Unit largest_unit);
|
||||
ThrowCompletionOr<InternalDuration> difference_plain_date_time_with_rounding(VM&, ISODateTime const&, ISODateTime const&, StringView calendar, Unit largest_unit, u64 rounding_increment, Unit smallest_unit, RoundingMode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue