mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Implement Temporal.PlainMonthDay.prototype.with/equals
This commit is contained in:
parent
5bccb36a6f
commit
5389acc231
Notes:
github-actions[bot]
2024-11-22 00:25:30 +00:00
Author: https://github.com/trflynn89
Commit: 5389acc231
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2471
10 changed files with 314 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <LibJS/Runtime/Temporal/Instant.h>
|
||||
#include <LibJS/Runtime/Temporal/PlainDate.h>
|
||||
#include <LibJS/Runtime/Temporal/PlainDateTime.h>
|
||||
#include <LibJS/Runtime/Temporal/PlainMonthDay.h>
|
||||
#include <LibJS/Runtime/Temporal/TimeZone.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
@ -451,6 +452,40 @@ Crypto::UnsignedBigInteger const& temporal_unit_length_in_nanoseconds(Unit unit)
|
|||
}
|
||||
}
|
||||
|
||||
// 13.23 IsPartialTemporalObject ( value ), https://tc39.es/proposal-temporal/#sec-temporal-ispartialtemporalobject
|
||||
ThrowCompletionOr<bool> is_partial_temporal_object(VM& vm, Value value)
|
||||
{
|
||||
// 1. If value is not an Object, return false.
|
||||
if (!value.is_object())
|
||||
return false;
|
||||
|
||||
auto const& object = value.as_object();
|
||||
|
||||
// 2. If value has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]],
|
||||
// [[InitializedTemporalTime]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal
|
||||
// slot, return false.
|
||||
// FIXME: Add the other types as we define them.
|
||||
if (is<PlainMonthDay>(object))
|
||||
return false;
|
||||
|
||||
// 3. Let calendarProperty be ? Get(value, "calendar").
|
||||
auto calendar_property = TRY(object.get(vm.names.calendar));
|
||||
|
||||
// 4. If calendarProperty is not undefined, return false.
|
||||
if (!calendar_property.is_undefined())
|
||||
return false;
|
||||
|
||||
// 5. Let timeZoneProperty be ? Get(value, "timeZone").
|
||||
auto time_zone_property = TRY(object.get(vm.names.timeZone));
|
||||
|
||||
// 6. If timeZoneProperty is not undefined, return false.
|
||||
if (!time_zone_property.is_undefined())
|
||||
return false;
|
||||
|
||||
// 7. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
// 13.24 FormatFractionalSeconds ( subSecondNanoseconds, precision ), https://tc39.es/proposal-temporal/#sec-temporal-formatfractionalseconds
|
||||
String format_fractional_seconds(u64 sub_second_nanoseconds, Precision precision)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue