summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibUnicode/DateTimeFormat.h
AgeCommit message (Collapse)Author
2021-12-13LibUnicode: Generate CalendarSymbols in a predetermined orderTimothy Flynn
Similar to commit 2a7f36b392, this change moves the generated CalendarSymbol enumeration to the public LibUnicode/NumberFormat.h header with a pre-defined set of symbols that we need. This is to prepare for uniquely generating the CalendarSymbols structure.
2021-12-10LibUnicode: Parse and generate per-locale day period rangesTimothy Flynn
2021-12-10LibUnicode: Parse and generate secondary day period symbolsTimothy Flynn
Generate morning2, afternoon2, evening2, and night2 symbols.
2021-12-10LibJS+LibUnicode: Rename some Unicode::DayPeriod valuesTimothy Flynn
In the CLDR, there aren't "night" values, there are "night1" & "night2" values. This is for locales which use a different name for nighttime depending on the hour. For example, the ja locale uses "倜" between the hours of 19:00 and 23:00, and "倜中" between the hours of 23:00 and 04:00. Our CLDR parser is currently ignoring "night2", so this rename is to prepare for that. We could probably come up with better names, but in the end, the API in LibUnicode will be such that outside callers won't even see Night1, etc.
2021-12-09LibUnicode: Add method to combine two format pattern skeletonsTimothy Flynn
The fields of the generated elements must be in the same order as the table here: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table Further, only one field from each group of fields is allowed.
2021-12-09LibUnicode: Parse and generate date time range format patternsTimothy Flynn
2021-12-09LibUnicode: Parse and generate format pattern skeletonsTimothy Flynn
Pattern skeletons are more or less the "key" of format patterns. Every format pattern is assigned a skeleton. Interval patterns (which are not yet parsed) are also assigned a skeleton - this is used to match them to an "owning" format pattern. So we will use the skeleton generated here to match format patterns at runtime with their available interval patterns. An alternative approach would be to append interval patterns directly to their owning format pattern, but this has some draw backs: 1. Skeletons aren't totally unique. A skeleton may appear in both the "dateFormats" and "availableFormats" objects, in which case the same interval formats would be generated more than once. 2. Otherwise unique format patterns may only differ by the interval patterns assigned to them. This would cause the UniqueStorage for the format patterns to increase in size, impacting both compile times and libunicode.so size.
2021-12-08LibUnicode: Parse and generate time zone names in long and short formTimothy Flynn
2021-12-08LibUnicode: Generate era, month, weekday and day period calendar symbolsTimothy Flynn
The parsing in parse_calendar_symbols() might be a bit more verbose than it really needs to be, but it is to ensure the symbols are generated in a known order that we can control with enumerations.
2021-12-08LibJS+LibUnicode: Supply field type in CalendarPattern's for-each methodTimothy Flynn
Some callers will want different behavior depending on what field is being provided to the callback.
2021-11-29LibJS+LibUnicode: Implement the Intl.DateTimeFormat constructorTimothy Flynn
2021-11-29LibUnicode: Parse and generate regional hour cyclesTimothy Flynn
Unlike most data in the CLDR, hour cycles are not stored on a per-locale basis. Instead, they are keyed by a string that is usually a region, but sometimes is a locale. Therefore, given a locale, to determine the hour cycles for that locale, we: 1. Check if the locale itself is assigned hour cycles. 2. If the locale has a region, check if that region is assigned hour cycles. 3. Otherwise, maximize that locale, and if the maximized locale has a region, check if that region is assigned hour cycles. 4. If the above all fail, fallback to the "001" region. Further, each locale's default hour cycle is the first assigned hour cycle.
2021-11-29LibUnicode: Parse and generate available candidate format patternsTimothy Flynn
These formats are used by ECMA-402 when neither a date nor time style is specified. In that case, these patterns are searched for a best match.
2021-11-29LibUnicode: Parse and generate date, time, and date-time format patternsTimothy Flynn