Skip to content

Commit

Permalink
[ACS-5857] reverted date field back to moment in form-field-model.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
SheenaMalhotra182 committed Oct 9, 2023
1 parent 27dbd03 commit f41a090
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,12 @@ export class FormFieldModel extends FormWidgetModel {
}
case FormFieldTypes.DATE: {
if (typeof this.value === 'string' && this.value === 'today') {
this.value = DateFnsUtils.formatDate(new Date(), this.dateDisplayFormat);
this.value = moment(new Date()).format(this.dateDisplayFormat);
}

const dateValue = DateFnsUtils.parseDate(this.value, this.dateDisplayFormat);

if (isValid(dateValue)) {
this.form.values[this.id] = `${DateFnsUtils.formatDate(dateValue, 'YYYY-MM-DD')}T00:00:00.000Z`;
const dateValue = moment(this.value, this.dateDisplayFormat, true);
if (dateValue?.isValid()) {
this.form.values[this.id] = `${dateValue.format('YYYY-MM-DD')}T00:00:00.000Z`;
} else {
this.form.values[this.id] = null;
this._value = this.value;
Expand Down

0 comments on commit f41a090

Please sign in to comment.