diff options
author | Linus Groh <mail@linusgroh.de> | 2021-07-28 19:29:45 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-28 21:57:30 +0100 |
commit | c69d8b69250e3939caa9623b522410f09609e316 (patch) | |
tree | 5d1777a176cbb515fdb62db63e208e54d5990662 /Userland/Utilities/js.cpp | |
parent | 5e64156fce5913665e598db4fe929b9c83bf744f (diff) | |
download | serenity-c69d8b69250e3939caa9623b522410f09609e316.zip |
js: Implement pretty-printing of Temporal.PlainTime objects
Diffstat (limited to 'Userland/Utilities/js.cpp')
-rw-r--r-- | Userland/Utilities/js.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index f686f8ae76..6b27295386 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -46,6 +46,7 @@ #include <LibJS/Runtime/Temporal/Instant.h> #include <LibJS/Runtime/Temporal/PlainDate.h> #include <LibJS/Runtime/Temporal/PlainDateTime.h> +#include <LibJS/Runtime/Temporal/PlainTime.h> #include <LibJS/Runtime/Temporal/TimeZone.h> #include <LibJS/Runtime/TypedArray.h> #include <LibJS/Runtime/Value.h> @@ -469,6 +470,13 @@ static void print_temporal_plain_date_time(JS::Object const& object, HashTable<J out(" \033[34;1m{:04}-{:02}-{:02} {:02}:{:02}:{:02}.{:03}{:03}{:03}\033[0m", plain_date_time.iso_year(), plain_date_time.iso_month(), plain_date_time.iso_day(), plain_date_time.iso_hour(), plain_date_time.iso_minute(), plain_date_time.iso_second(), plain_date_time.iso_millisecond(), plain_date_time.iso_microsecond(), plain_date_time.iso_nanosecond()); } +static void print_temporal_plain_time(JS::Object const& object, HashTable<JS::Object*>&) +{ + auto& plain_time = static_cast<JS::Temporal::PlainTime const&>(object); + print_type("Temporal.PlainTime"); + out(" \033[34;1m{:02}:{:02}:{:02}.{:03}{:03}{:03}\033[0m", plain_time.iso_hour(), plain_time.iso_minute(), plain_time.iso_second(), plain_time.iso_millisecond(), plain_time.iso_microsecond(), plain_time.iso_nanosecond()); +} + static void print_temporal_time_zone(JS::Object const& object, HashTable<JS::Object*>& seen_objects) { auto& time_zone = static_cast<JS::Temporal::TimeZone const&>(object); @@ -548,6 +556,8 @@ static void print_value(JS::Value value, HashTable<JS::Object*>& seen_objects) return print_temporal_plain_date(object, seen_objects); if (is<JS::Temporal::PlainDateTime>(object)) return print_temporal_plain_date_time(object, seen_objects); + if (is<JS::Temporal::PlainTime>(object)) + return print_temporal_plain_time(object, seen_objects); if (is<JS::Temporal::TimeZone>(object)) return print_temporal_time_zone(object, seen_objects); return print_object(object, seen_objects); |