From 41a48e706102585cbd4a175198fab29b74d150cf Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 21 Oct 2025 15:41:57 -0300 Subject: language: formatMonthDay() --- src/data/things/language.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/data/things') diff --git a/src/data/things/language.js b/src/data/things/language.js index 631df94d..0354b6ac 100644 --- a/src/data/things/language.js +++ b/src/data/things/language.js @@ -99,6 +99,7 @@ export class Language extends Thing { intl_date: this.#intlHelper(Intl.DateTimeFormat, {full: true}), intl_dateYear: this.#intlHelper(Intl.DateTimeFormat, {year: 'numeric'}), + intl_dateMonthDay: this.#intlHelper(Intl.DateTimeFormat, {month: 'numeric', day: 'numeric'}), intl_number: this.#intlHelper(Intl.NumberFormat), intl_listConjunction: this.#intlHelper(Intl.ListFormat, {type: 'conjunction'}), intl_listDisjunction: this.#intlHelper(Intl.ListFormat, {type: 'disjunction'}), @@ -463,6 +464,15 @@ export class Language extends Thing { return this.intl_dateYear.format(date); } + formatMonthDay(date) { + if (date === null || date === undefined) { + return html.blank(); + } + + this.assertIntlAvailable('intl_dateMonthDay'); + return this.intl_dateMonthDay.format(date); + } + formatYearRange(startDate, endDate) { // formatYearRange expects both values to be present, but if both are null // or both are undefined, that's just blank content. -- cgit 1.3.0-6-gf8a5