mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +00:00
LibJS: Handle ZonedDateTime in ToTemporalTimeZone
This commit is contained in:
parent
fa0d6d1045
commit
1f5098f61e
1 changed files with 7 additions and 2 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include <LibJS/Runtime/Temporal/PlainDateTime.h>
|
#include <LibJS/Runtime/Temporal/PlainDateTime.h>
|
||||||
#include <LibJS/Runtime/Temporal/TimeZone.h>
|
#include <LibJS/Runtime/Temporal/TimeZone.h>
|
||||||
#include <LibJS/Runtime/Temporal/TimeZoneConstructor.h>
|
#include <LibJS/Runtime/Temporal/TimeZoneConstructor.h>
|
||||||
|
#include <LibJS/Runtime/Temporal/ZonedDateTime.h>
|
||||||
|
|
||||||
namespace JS::Temporal {
|
namespace JS::Temporal {
|
||||||
|
|
||||||
|
@ -326,9 +327,13 @@ Object* to_temporal_time_zone(GlobalObject& global_object, Value temporal_time_z
|
||||||
|
|
||||||
// 1. If Type(temporalTimeZoneLike) is Object, then
|
// 1. If Type(temporalTimeZoneLike) is Object, then
|
||||||
if (temporal_time_zone_like.is_object()) {
|
if (temporal_time_zone_like.is_object()) {
|
||||||
// TODO:
|
|
||||||
// a. If temporalTimeZoneLike has an [[InitializedTemporalZonedDateTime]] internal slot, then
|
// a. If temporalTimeZoneLike has an [[InitializedTemporalZonedDateTime]] internal slot, then
|
||||||
// i. Return temporalTimeZoneLike.[[TimeZone]].
|
if (is<ZonedDateTime>(temporal_time_zone_like.as_object())) {
|
||||||
|
auto& zoned_date_time = static_cast<ZonedDateTime&>(temporal_time_zone_like.as_object());
|
||||||
|
|
||||||
|
// i. Return temporalTimeZoneLike.[[TimeZone]].
|
||||||
|
return &zoned_date_time.time_zone();
|
||||||
|
}
|
||||||
|
|
||||||
// b. If ? HasProperty(temporalTimeZoneLike, "timeZone") is false, return temporalTimeZoneLike.
|
// b. If ? HasProperty(temporalTimeZoneLike, "timeZone") is false, return temporalTimeZoneLike.
|
||||||
auto has_property = temporal_time_zone_like.as_object().has_property(vm.names.timeZone);
|
auto has_property = temporal_time_zone_like.as_object().has_property(vm.names.timeZone);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue