/* * Copyright (c) 2021-2024, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace JS::Intl { class DateTimeFormatConstructor final : public NativeFunction { JS_OBJECT(DateTimeFormatConstructor, NativeFunction); GC_DECLARE_ALLOCATOR(DateTimeFormatConstructor); public: virtual void initialize(Realm&) override; virtual ~DateTimeFormatConstructor() override = default; virtual ThrowCompletionOr call() override; virtual ThrowCompletionOr> construct(FunctionObject& new_target) override; private: explicit DateTimeFormatConstructor(Realm&); virtual bool has_constructor() const override { return true; } JS_DECLARE_NATIVE_FUNCTION(supported_locales_of); }; enum class OptionRequired { Any, Date, Time, YearMonth, MonthDay, }; enum class OptionDefaults { All, Date, Time, YearMonth, MonthDay, ZonedDateTime, }; enum class OptionInherit { All, Relevant, }; ThrowCompletionOr> create_date_time_format(VM&, FunctionObject& new_target, Value locales_value, Value options_value, OptionRequired, OptionDefaults, Optional const& to_locale_string_time_zone = {}); String format_offset_time_zone_identifier(double offset_minutes); }