diff --git a/src/data/automation_i18n.ts b/src/data/automation_i18n.ts index 0790fb9db3..2c3f601a57 100644 --- a/src/data/automation_i18n.ts +++ b/src/data/automation_i18n.ts @@ -813,16 +813,16 @@ const describeLegacyTrigger = ( : trigger.entity_id; let offsetChoice = "other"; - let offset: string | string[] = ""; + let offset = ""; if (trigger.offset) { offsetChoice = trigger.offset.startsWith("-") ? "before" : "after"; - offset = trigger.offset.startsWith("-") + const parts = trigger.offset.startsWith("-") ? trigger.offset.substring(1).split(":") : trigger.offset.split(":"); const duration = { - hours: offset.length > 0 ? +offset[0] : 0, - minutes: offset.length > 1 ? +offset[1] : 0, - seconds: offset.length > 2 ? +offset[2] : 0, + hours: parts.length > 0 ? +parts[0] : 0, + minutes: parts.length > 1 ? +parts[1] : 0, + seconds: parts.length > 2 ? +parts[2] : 0, }; offset = formatDurationLong(hass.locale, duration); if (offset === "") { diff --git a/tsconfig.json b/tsconfig.json index 453ff48423..9038da049a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "useDefineForClassFields": false, // Modules "module": "ESNext", - "moduleResolution": "node", + "moduleResolution": "bundler", "resolveJsonModule": true, // Babel handles transpiling and no need for declaration files "noEmit": true, @@ -130,7 +130,35 @@ ], "@formatjs/intl-relativetimeformat/polyfill-force": [ "./node_modules/@formatjs/intl-relativetimeformat/polyfill-force.js" - ] + ], + "@formatjs/intl-durationformat/src/types": [ + "./node_modules/@formatjs/intl-durationformat/src/types.js" + ], + "@formatjs/intl-pluralrules/locale-data/en": [ + "./node_modules/@formatjs/intl-pluralrules/locale-data/en.js" + ], + "@home-assistant/webawesome/dist/components/*": [ + "./node_modules/@home-assistant/webawesome/dist/components/*" + ], + "@home-assistant/webawesome/dist/events/*": [ + "./node_modules/@home-assistant/webawesome/dist/events/*" + ], + "@home-assistant/webawesome/dist/internal/*": [ + "./node_modules/@home-assistant/webawesome/dist/internal/*" + ], + "@lit-labs/virtualizer/virtualize": [ + "./node_modules/@lit-labs/virtualizer/virtualize.js" + ], + "@lit/reactive-element/reactive-controller": [ + "./node_modules/@lit/reactive-element/reactive-controller.js" + ], + "echarts/types/src/*": ["./node_modules/echarts/types/src/*.d.ts"], + "echarts/lib/*": ["./node_modules/echarts/lib/*"], + "home-assistant-js-websocket/dist/*": [ + "./node_modules/home-assistant-js-websocket/dist/*" + ], + "lit/directives/join": ["./node_modules/lit/directives/join.js"], + "lit/directives/ref": ["./node_modules/lit/directives/ref.js"] } } }