mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix weather more info date display (#17440)
This commit is contained in:
parent
f953ec6e1c
commit
4612099e88
@ -6,11 +6,11 @@ import {
|
||||
mdiWeatherWindy,
|
||||
} from "@mdi/js";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
PropertyValues,
|
||||
css,
|
||||
html,
|
||||
nothing,
|
||||
} from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
@ -19,13 +19,13 @@ import { formatTimeWeekday } from "../../../common/datetime/format_time";
|
||||
import { formatNumber } from "../../../common/number/format_number";
|
||||
import "../../../components/ha-svg-icon";
|
||||
import {
|
||||
ForecastEvent,
|
||||
WeatherEntity,
|
||||
getDefaultForecastType,
|
||||
getForecast,
|
||||
getWeatherUnit,
|
||||
getWind,
|
||||
subscribeForecast,
|
||||
ForecastEvent,
|
||||
WeatherEntity,
|
||||
weatherIcons,
|
||||
} from "../../../data/weather";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
@ -122,6 +122,7 @@ class MoreInfoWeather extends LitElement {
|
||||
);
|
||||
const forecast = forecastData?.forecast;
|
||||
const hourly = forecastData?.type === "hourly";
|
||||
const dayNight = forecastData?.type === "twice_daily";
|
||||
|
||||
return html`
|
||||
${this._showValue(this.stateObj.attributes.temperature)
|
||||
@ -225,28 +226,34 @@ class MoreInfoWeather extends LitElement {
|
||||
></ha-svg-icon>
|
||||
`
|
||||
: ""}
|
||||
${hourly
|
||||
? html`
|
||||
<div class="main">
|
||||
${formatTimeWeekday(
|
||||
new Date(item.datetime),
|
||||
this.hass.locale,
|
||||
this.hass.config
|
||||
)}
|
||||
</div>
|
||||
`
|
||||
: html`
|
||||
<div class="main">
|
||||
<div class="main">
|
||||
${dayNight
|
||||
? html`
|
||||
${formatDateWeekdayDay(
|
||||
new Date(item.datetime),
|
||||
this.hass.locale,
|
||||
this.hass.config
|
||||
this.hass!.locale,
|
||||
this.hass!.config
|
||||
)}
|
||||
${item.is_daytime !== false
|
||||
(${item.is_daytime !== false
|
||||
? this.hass!.localize("ui.card.weather.day")
|
||||
: this.hass!.localize("ui.card.weather.night")}
|
||||
</div>
|
||||
`}
|
||||
: this.hass!.localize("ui.card.weather.night")})
|
||||
`
|
||||
: hourly
|
||||
? html`
|
||||
${formatTimeWeekday(
|
||||
new Date(item.datetime),
|
||||
this.hass!.locale,
|
||||
this.hass!.config
|
||||
)}
|
||||
`
|
||||
: html`
|
||||
${formatDateWeekdayDay(
|
||||
new Date(item.datetime),
|
||||
this.hass!.locale,
|
||||
this.hass!.config
|
||||
)}
|
||||
`}
|
||||
</div>
|
||||
<div class="templow">
|
||||
${this._showValue(item.templow)
|
||||
? `${formatNumber(item.templow!, this.hass.locale)}
|
||||
|
@ -352,9 +352,10 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard {
|
||||
<div>
|
||||
${dayNight
|
||||
? html`
|
||||
${new Date(item.datetime).toLocaleDateString(
|
||||
this.hass!.language,
|
||||
{ weekday: "short" }
|
||||
${formatDateWeekdayShort(
|
||||
new Date(item.datetime),
|
||||
this.hass!.locale,
|
||||
this.hass!.config
|
||||
)}
|
||||
<div class="daynight">
|
||||
${item.is_daytime !== false
|
||||
|
Loading…
x
Reference in New Issue
Block a user