Merge pull request #2741 from AnvayKharb/WEB-389-editing-existing-holidays-fails-due-to-date-format-problem
WEB-389: Fix date format issue when editing holidays
This commit is contained in:
@@ -332,11 +332,14 @@ export class CreateHolidayComponent implements OnInit {
|
||||
const locale = this.settings.language.code;
|
||||
const prevFromDate: Date = this.holidayForm.value.fromDate;
|
||||
const prevToDate: Date = this.holidayForm.value.toDate;
|
||||
holidayFormData.fromDate = this.dateUtils.formatDate(prevFromDate, dateFormat);
|
||||
holidayFormData.toDate = this.dateUtils.formatDate(prevToDate, dateFormat);
|
||||
holidayFormData.fromDate = this.dateUtils.formatDateAsString(prevFromDate, dateFormat);
|
||||
holidayFormData.toDate = this.dateUtils.formatDateAsString(prevToDate, dateFormat);
|
||||
if (this.holidayForm.contains('repaymentsRescheduledTo')) {
|
||||
const prevRepaymentsRescheduledTo: Date = this.holidayForm.value.repaymentsRescheduledTo;
|
||||
holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDate(prevRepaymentsRescheduledTo, dateFormat);
|
||||
holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDateAsString(
|
||||
prevRepaymentsRescheduledTo,
|
||||
dateFormat
|
||||
);
|
||||
}
|
||||
const offices = this.holidayForm.value.offices.map((office: string) => {
|
||||
return { officeId: Number.parseInt(office, 10) };
|
||||
|
||||
@@ -134,17 +134,20 @@ export class EditHolidayComponent implements OnInit {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
if (!this.isActiveHoliday) {
|
||||
if (holidayFormData.fromDate instanceof Date) {
|
||||
holidayFormData.fromDate = this.dateUtils.formatDate(holidayFormData.fromDate, dateFormat);
|
||||
const prevFromDate = this.holidayForm.value.fromDate;
|
||||
const prevToDate = this.holidayForm.value.toDate;
|
||||
|
||||
if (prevFromDate instanceof Date) {
|
||||
holidayFormData.fromDate = this.dateUtils.formatDateAsString(prevFromDate, dateFormat);
|
||||
}
|
||||
if (holidayFormData.toDate instanceof Date) {
|
||||
holidayFormData.toDate = this.dateUtils.formatDate(holidayFormData.toDate, dateFormat);
|
||||
if (prevToDate instanceof Date) {
|
||||
holidayFormData.toDate = this.dateUtils.formatDateAsString(prevToDate, dateFormat);
|
||||
}
|
||||
if (this.reSchedulingType === 2 && holidayFormData.repaymentsRescheduledTo instanceof Date) {
|
||||
holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDate(
|
||||
holidayFormData.repaymentsRescheduledTo,
|
||||
dateFormat
|
||||
);
|
||||
if (this.reSchedulingType === 2) {
|
||||
const repaymentScheduledTo = this.holidayForm.value.repaymentsRescheduledTo;
|
||||
if (repaymentScheduledTo instanceof Date) {
|
||||
holidayFormData.repaymentsRescheduledTo = this.dateUtils.formatDateAsString(repaymentScheduledTo, dateFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = {
|
||||
|
||||
Reference in New Issue
Block a user