LibJS: Don't use Temporal to parse UTC offset strings

The production for these strings has been removed from Temporal. This
implements a separate parser in accordance with the Date spec.
This commit is contained in:
Timothy Flynn 2024-11-16 16:21:51 -05:00 committed by Tim Flynn
commit dd6acfecd4
Notes: github-actions[bot] 2024-11-18 22:47:54 +00:00
3 changed files with 192 additions and 40 deletions

View file

@ -58,6 +58,14 @@ constexpr inline double ms_per_day = 86'400'000;
constexpr inline double ns_per_day = 86'400'000'000'000;
extern Crypto::SignedBigInteger const ns_per_day_bigint;
struct UTCOffset {
Optional<char> sign;
Optional<u8> hour;
Optional<u8> minute;
Optional<u8> second;
Optional<StringView> fraction;
};
double day(double);
double time_within_day(double);
u16 days_in_year(i32);
@ -85,6 +93,7 @@ double make_time(double hour, double min, double sec, double ms);
double make_day(double year, double month, double date);
double make_date(double day, double time);
double time_clip(double time);
Optional<UTCOffset> parse_utc_offset(StringView);
bool is_time_zone_offset_string(StringView offset_string);
double parse_time_zone_offset_string(StringView offset_string);