From cc8644ce34e6c260c26937516e898b4cdec3fcca Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 6 Sep 2021 23:02:33 +0100 Subject: [PATCH] js: Implement pretty-printing of Temporal.PlainMonthDay objects --- Userland/Utilities/js.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 424783ea4f..6b0f541359 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -475,6 +476,14 @@ static void print_temporal_plain_date_time(JS::Object const& object, HashTable&) +{ + auto& plain_month_day = static_cast(object); + print_type("Temporal.PlainMonthDay"); + // Also has an [[ISOYear]] internal slot, but showing that here seems rather unexpected. + out(" \033[34;1m{:02}-{:02}\033[0m", plain_month_day.iso_month(), plain_month_day.iso_day()); +} + static void print_temporal_plain_time(JS::Object const& object, HashTable&) { auto& plain_time = static_cast(object); @@ -625,6 +634,8 @@ static void print_value(JS::Value value, HashTable& seen_objects) return print_temporal_plain_date(object, seen_objects); if (is(object)) return print_temporal_plain_date_time(object, seen_objects); + if (is(object)) + return print_temporal_plain_month_day(object, seen_objects); if (is(object)) return print_temporal_plain_time(object, seen_objects); if (is(object))