Files
ladybird/Libraries/LibUnicode/Calendars/Constants.h
Timothy Flynn 34d7a8fa69 LibUnicode: Handle ICU vs ECMA-402 era formatting discrepancies
ICU's Islamic calendar implementations always set ERA=0, even for dates
before the Hijra (622 CE), using negative year values instead. However,
the CLDR defines two eras: "Anno Hegirae" (era 0) and "Before Hijrah"
(era 1). ECMA-402 expects distinct era names in formatToParts output.
Similarly, ICU's Coptic calendar has an empty CLDR era 0 name, causing
the era parts to be omitted entirely from formatted output.

This patch adds another icu::Calendar subclass to handle these cases.
2026-03-13 14:43:45 -04:00

23 lines
547 B
C++

/*
* Copyright (c) 2026, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
namespace Unicode {
// https://github.com/unicode-org/icu/blob/main/icu4c/source/i18n/gregoimp.h#L127
constexpr inline i64 EPOCH_START_AS_JULIAN_DAY = 2440588;
// https://en.wikipedia.org/wiki/Chinese_calendar_correspondence_table
constexpr inline i32 CHINESE_CALENDAR_FIRST_YEAR = -2637;
// https://en.wikipedia.org/wiki/Dangun_calendar
constexpr inline i32 DANGI_CALENDAR_FIRST_YEAR = -2333;
}