From 651feb6866e8018ce9bf539a89ff585c73dd75bc Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Mon, 6 Sep 2021 22:57:25 +0100 Subject: [PATCH] js: Implement pretty-printing of Temporal.PlainYearMonth objects --- Userland/Utilities/js.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index 422ab5769a..424783ea4f 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -481,6 +482,14 @@ static void print_temporal_plain_time(JS::Object const& object, HashTable&) +{ + auto& plain_year_month = static_cast(object); + print_type("Temporal.PlainYearMonth"); + // Also has an [[ISODay]] internal slot, but showing that here seems rather unexpected. + out(" \033[34;1m{:04}-{:02}\033[0m", plain_year_month.iso_year(), plain_year_month.iso_month()); +} + static void print_temporal_time_zone(JS::Object const& object, HashTable& seen_objects) { auto& time_zone = static_cast(object); @@ -618,6 +627,8 @@ static void print_value(JS::Value value, HashTable& seen_objects) return print_temporal_plain_date_time(object, seen_objects); if (is(object)) return print_temporal_plain_time(object, seen_objects); + if (is(object)) + return print_temporal_plain_year_month(object, seen_objects); if (is(object)) return print_temporal_time_zone(object, seen_objects); if (is(object))