Use consistent US locales for dates

https://3.basecamp.com/2914079/buckets/37331921/todos/9010176047#__recording_9040694230
This commit is contained in:
Jorge Manrubia
2025-09-05 16:40:46 +02:00
parent 601411e3a9
commit 80ca9cac9d
@@ -9,14 +9,14 @@ export default class extends Controller {
#timer
initialize() {
this.timeFormatter = new Intl.DateTimeFormat(undefined, { timeStyle: "short" })
this.dateFormatter = new Intl.DateTimeFormat(undefined, { dateStyle: "long" })
this.shortdateFormatter = new Intl.DateTimeFormat(undefined, { month: "short", day: "numeric" })
this.datetimeFormatter = new Intl.DateTimeFormat(undefined, { timeStyle: "short", dateStyle: "short" })
this.timeFormatter = new Intl.DateTimeFormat("en-US", { timeStyle: "short" })
this.dateFormatter = new Intl.DateTimeFormat("en-US", { dateStyle: "long" })
this.shortdateFormatter = new Intl.DateTimeFormat("en-US", { month: "short", day: "numeric" })
this.datetimeFormatter = new Intl.DateTimeFormat("en-US", { timeStyle: "short", dateStyle: "short" })
this.agoFormatter = new AgoFormatter()
this.daysagoFormatter = new DaysAgoFormatter()
this.datewithweekdayFormatter = new Intl.DateTimeFormat(undefined, { weekday: "long", month: "long", day: "numeric" })
this.datewithweekdayFormatter = new Intl.DateTimeFormat(undefined, { weekday: "long", month: "long", day: "numeric" })
this.datewithweekdayFormatter = new Intl.DateTimeFormat("en-US", { weekday: "long", month: "long", day: "numeric" })
this.datewithweekdayFormatter = new Intl.DateTimeFormat("en-US", { weekday: "long", month: "long", day: "numeric" })
this.indaysFormatter = new InDaysFormatter()
this.agoorweekdayFormatter = new DaysAgoOrWeekdayFormatter()
this.timeordateFormatter = new TimeOrDateFormatter()
@@ -138,7 +138,7 @@ class DaysAgoOrWeekdayFormatter {
if (days <= 1) {
return new DaysAgoFormatter().format(date)
} else {
return new Intl.DateTimeFormat(undefined, { weekday: "long", month: "long", day: "numeric" }).format(date)
return new Intl.DateTimeFormat("en-US", { weekday: "long", month: "long", day: "numeric" }).format(date)
}
}
}
@@ -158,9 +158,9 @@ class TimeOrDateFormatter {
const days = differenceInDays(date, new Date())
if (days >= 1) {
return new Intl.DateTimeFormat(undefined, { month: "short", day: "numeric" }).format(date)
return new Intl.DateTimeFormat("en-US", { month: "short", day: "numeric" }).format(date)
} else {
return new Intl.DateTimeFormat(undefined, { timeStyle: "short" }).format(date)
return new Intl.DateTimeFormat("en-US", { timeStyle: "short" }).format(date)
}
}
}