From 3f16b199ef2a940698bbcef006aab31966974f33 Mon Sep 17 00:00:00 2001 From: Patrick Kissling Date: Sat, 14 Jan 2023 11:15:45 +0100 Subject: [PATCH] Fix error when using language English (US) in HA --- src/clock-weather-card.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/clock-weather-card.ts b/src/clock-weather-card.ts index 1f7f290c..764a114a 100644 --- a/src/clock-weather-card.ts +++ b/src/clock-weather-card.ts @@ -376,10 +376,14 @@ export class ClockWeatherCard extends LitElement { const localeOne = localeParts[0].toLowerCase(); const localeTwo = localeParts[1]?.toUpperCase() || ''; const dateFnsLocale = localeOne + localeTwo; + // HA provides en-US as en + if (dateFnsLocale === 'en') { + return locales.enUS; + } const importedLocale = locales[dateFnsLocale]; if (!importedLocale) { - console.error('clock-weather-card - Locale not supported: ' + dateFnsLocale) - return locales.enGB + console.error('clock-weather-card - Locale not supported: ' + dateFnsLocale); + return locales.enGB; } return importedLocale; }