From 454ecf24ea90057666d0e75e4473e7f6d551a985 Mon Sep 17 00:00:00 2001 From: MacDue Date: Tue, 18 Apr 2023 18:31:00 +0100 Subject: AK+LibTimeZone: Add debug only formatter for Optional I found this handy for debugging, and so might others. This now also adds a formatter for TimeZone::TimeZone. This is needed for FormatIfSupported> to compile. As FormatIfSupported sees a formatter for Optional exists, but not that there's not one for TimeZone::TimeZone. --- Userland/Libraries/LibTimeZone/TimeZone.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Userland/Libraries') diff --git a/Userland/Libraries/LibTimeZone/TimeZone.h b/Userland/Libraries/LibTimeZone/TimeZone.h index e813c9d7ad..52e20170f3 100644 --- a/Userland/Libraries/LibTimeZone/TimeZone.h +++ b/Userland/Libraries/LibTimeZone/TimeZone.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -74,3 +75,11 @@ StringView region_to_string(Region region); Vector time_zones_in_region(StringView region); } + +template<> +struct AK::Formatter : Formatter { + ErrorOr format(FormatBuilder& builder, TimeZone::TimeZone const& time_zone) + { + return Formatter::format(builder, TimeZone::time_zone_to_string(time_zone)); + } +}; -- cgit v1.2.3