diff --git a/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.ts b/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.ts index c9839cb..25440b8 100644 --- a/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.ts +++ b/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.ts @@ -74,6 +74,11 @@ export class CreateCalendarRuleComponent { .filter(index => index !== -1); } + convertDateToLocalISO(date: Date): string { + const adjustedDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())); + return adjustedDate.toISOString(); + } + submitRule(): void { this.getSelectedDaysIndices() const selectedDaysArray = Object.keys(this.busyWeekDays).map((day, index) => this.busyWeekDays[index]); @@ -83,8 +88,8 @@ export class CreateCalendarRuleComponent { busyWeekDays: this.selectedDaysIndices, busyFromHour: this.busyFromHour, busyToHour: this.busyToHour, - availableFromDate: this.availableFromDate, - availableToDate: this.availableToDate, + availableFromDate: this.availableFromDate ? this.convertDateToLocalISO(this.availableFromDate) : null, + availableToDate: this.availableToDate ? this.convertDateToLocalISO(this.availableToDate) : null, isRemoteAvailable: this.isRemoteAvailable, availableReason: this.availableReason };