mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix accidental date cross-overs in local cal event creation (#14587)
This commit is contained in:
parent
8a5f781ca2
commit
774259224b
@ -302,7 +302,11 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
const duration = differenceInMilliseconds(this._dtend!, this._dtstart!);
|
const duration = differenceInMilliseconds(this._dtend!, this._dtstart!);
|
||||||
|
|
||||||
this._dtstart = new Date(
|
this._dtstart = new Date(
|
||||||
ev.detail.value + "T" + this._dtstart!.toISOString().split("T")[1]
|
ev.detail.value +
|
||||||
|
"T" +
|
||||||
|
this._dtstart!.toLocaleTimeString("en-GB", {
|
||||||
|
timeZone: this.hass.config.time_zone,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Prevent that the end time can be before the start time. Try to keep the
|
// Prevent that the end time can be before the start time. Try to keep the
|
||||||
@ -326,7 +330,11 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
|
|
||||||
private _endDateChanged(ev: CustomEvent) {
|
private _endDateChanged(ev: CustomEvent) {
|
||||||
this._dtend = new Date(
|
this._dtend = new Date(
|
||||||
ev.detail.value + "T" + this._dtend!.toISOString().split("T")[1]
|
ev.detail.value +
|
||||||
|
"T" +
|
||||||
|
this._dtend!.toLocaleTimeString("en-GB", {
|
||||||
|
timeZone: this.hass.config.time_zone,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +343,11 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
const duration = differenceInMilliseconds(this._dtend!, this._dtstart!);
|
const duration = differenceInMilliseconds(this._dtend!, this._dtstart!);
|
||||||
|
|
||||||
this._dtstart = new Date(
|
this._dtstart = new Date(
|
||||||
this._dtstart!.toISOString().split("T")[0] + "T" + ev.detail.value
|
this._dtstart!.toLocaleDateString("en-CA", {
|
||||||
|
timeZone: this.hass.config.time_zone,
|
||||||
|
}) +
|
||||||
|
"T" +
|
||||||
|
ev.detail.value
|
||||||
);
|
);
|
||||||
|
|
||||||
// Prevent that the end time can be before the start time. Try to keep the
|
// Prevent that the end time can be before the start time. Try to keep the
|
||||||
@ -357,7 +369,11 @@ class DialogCalendarEventEditor extends LitElement {
|
|||||||
|
|
||||||
private _endTimeChanged(ev: CustomEvent) {
|
private _endTimeChanged(ev: CustomEvent) {
|
||||||
this._dtend = new Date(
|
this._dtend = new Date(
|
||||||
this._dtend!.toISOString().split("T")[0] + "T" + ev.detail.value
|
this._dtend!.toLocaleDateString("en-CA", {
|
||||||
|
timeZone: this.hass.config.time_zone,
|
||||||
|
}) +
|
||||||
|
"T" +
|
||||||
|
ev.detail.value
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user