« get me outta code hell

language: formatMonthDay() - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-21 15:41:57 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-21 15:41:57 -0300
commit41a48e706102585cbd4a175198fab29b74d150cf (patch)
tree2f3c33836e8f86cbc0ee029d6a65518cab5ae2e7
parentc3b4b0bebca07a69f6c47d680f0c18d859cb599c (diff)
language: formatMonthDay()
-rw-r--r--src/data/things/language.js10
1 files changed, 10 insertions, 0 deletions
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.