mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:17:44 +00:00
LibJS: Implement Temporal.PlainDateTime.prototype.minute
This commit is contained in:
parent
f553ab3104
commit
6dd0815fad
3 changed files with 29 additions and 0 deletions
|
@ -33,6 +33,7 @@ void PlainDateTimePrototype::initialize(GlobalObject& global_object)
|
|||
define_native_accessor(vm.names.monthCode, month_code_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.day, day_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.hour, hour_getter, {}, Attribute::Configurable);
|
||||
define_native_accessor(vm.names.minute, minute_getter, {}, Attribute::Configurable);
|
||||
|
||||
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||
define_native_function(vm.names.valueOf, value_of, 0, attr);
|
||||
|
@ -143,6 +144,19 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::hour_getter)
|
|||
return Value(date_time->iso_hour());
|
||||
}
|
||||
|
||||
// 5.3.9 get Temporal.PlainDateTime.prototype.minute, https://tc39.es/proposal-temporal/#sec-get-temporal.plaindatetime.prototype.minute
|
||||
JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::minute_getter)
|
||||
{
|
||||
// 1. Let dateTime be the this value.
|
||||
// 2. Perform ? RequireInternalSlot(dateTime, [[InitializedTemporalDateTime]]).
|
||||
auto* date_time = typed_this(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
// 3. Return 𝔽(dateTime.[[ISOMinute]]).
|
||||
return Value(date_time->iso_minute());
|
||||
}
|
||||
|
||||
// 5.3.35 Temporal.PlainDateTime.prototype.valueOf ( ), https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.valueof
|
||||
JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::value_of)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ private:
|
|||
JS_DECLARE_NATIVE_FUNCTION(month_code_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(day_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(hour_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(minute_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(value_of);
|
||||
JS_DECLARE_NATIVE_FUNCTION(to_plain_date);
|
||||
JS_DECLARE_NATIVE_FUNCTION(get_iso_fields);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue