mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Fix All Day recurring events that end on a specific date (#14905)
This commit is contained in:
parent
a16e41a7ac
commit
4901d50918
@ -250,6 +250,7 @@ class DialogCalendarEventEditor extends LitElement {
|
||||
<ha-recurrence-rule-editor
|
||||
.hass=${this.hass}
|
||||
.dtstart=${this._dtstart}
|
||||
.allDay=${this._allDay}
|
||||
.locale=${this.hass.locale}
|
||||
.timezone=${this.hass.config.time_zone}
|
||||
.value=${this._rrule || ""}
|
||||
|
@ -41,6 +41,8 @@ export class RecurrenceRuleEditor extends LitElement {
|
||||
|
||||
@property() public dtstart?: Date;
|
||||
|
||||
@property() public allDay?: boolean;
|
||||
|
||||
@property({ attribute: false }) public locale!: HomeAssistant["locale"];
|
||||
|
||||
@property() public timezone?: string;
|
||||
@ -402,7 +404,14 @@ export class RecurrenceRuleEditor extends LitElement {
|
||||
byweekday: byweekday,
|
||||
bymonthday: bymonthday,
|
||||
};
|
||||
const contentline = RRule.optionsToString(options);
|
||||
let contentline = RRule.optionsToString(options);
|
||||
if (this._until && this.allDay) {
|
||||
// rrule.js only computes UNTIL values as DATE-TIME however rfc5545 says
|
||||
// The value of the UNTIL rule part MUST have the same value type as the
|
||||
// "DTSTART" property. If needed, strip off any time values as a workaround
|
||||
// This converts "UNTIL=20220512T060000" to "UNTIL=20220512"
|
||||
contentline = contentline.replace(/(UNTIL=\d{8})T\d{6}Z?/, "$1");
|
||||
}
|
||||
return contentline.slice(6); // Strip "RRULE:" prefix
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user