WEB-357 Editing a holiday fails due to failure to parse from date format

This commit is contained in:
JaySoni1
2025-11-04 06:52:27 +05:30
parent 28beb149a2
commit 7ed03d62ce
@@ -134,17 +134,17 @@ export class EditHolidayComponent implements OnInit {
const locale = this.settingsService.language.code; const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat; const dateFormat = this.settingsService.dateFormat;
if (!this.isActiveHoliday) { if (!this.isActiveHoliday) {
if (this.reSchedulingType === 2) { if (holidayFormData.fromDate instanceof Date) {
const repaymentScheduledTo: Date = this.holidayForm.value.repaymentsRescheduledTo; holidayFormData.fromDate = this.dateUtils.formatDate(holidayFormData.fromDate, dateFormat);
holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDate(repaymentScheduledTo, dateFormat);
} }
const prevFromDate: Date = this.holidayForm.value.fromDate; if (holidayFormData.toDate instanceof Date) {
const prevToDate: Date = this.holidayForm.value.toDate; holidayFormData.toDate = this.dateUtils.formatDate(holidayFormData.toDate, dateFormat);
if (holidayFormData.closureDate instanceof Date) {
holidayFormData.fromDate = this.dateUtils.formatDate(prevFromDate, dateFormat);
} }
if (holidayFormData.closureDate instanceof Date) { if (this.reSchedulingType === 2 && holidayFormData.repaymentsRescheduledTo instanceof Date) {
holidayFormData.toDate = this.dateUtils.formatDate(prevToDate, dateFormat); holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDate(
holidayFormData.repaymentsRescheduledTo,
dateFormat
);
} }
} }
const data = { const data = {