AAE-34140 Asynchronous Forms - automatically populated value cannot be used in another task (#11574)

* AAE-34140 Asynchronous Forms - automatically populated value cannot be used in another task

* update

* update
This commit is contained in:
Bartosz Sekula
2026-01-26 10:21:00 +01:00
committed by GitHub
parent 6a269dde79
commit 3f01a92d67
2 changed files with 36 additions and 1 deletions
@@ -420,6 +420,33 @@ describe('FormFieldModel', () => {
expect(formDateTimeFormatted).toEqual(currentDateTimeFormatted);
});
it('should handle properly date string that is in ISO format', () => {
const form = new FormModel();
const field = new FormFieldModel(form, {
fieldType: 'FormFieldRepresentation',
id: 'date',
name: 'date',
type: FormFieldTypes.DATE,
value: '',
required: false,
readOnly: false,
params: {
field: {
id: 'date',
name: 'date',
type: FormFieldTypes.DATE,
value: '',
required: false,
readOnly: false
}
}
});
field.value = '2026-01-23T15:25:03.439+0000';
expect(field.getFormValue()).toEqual('2026-01-23T00:00:00.000Z');
});
it('should set the value to null when the value is null', () => {
const form = new FormModel();
const field = new FormFieldModel(form, {
@@ -681,7 +681,15 @@ export class FormFieldModel extends FormWidgetModel {
let dateValue;
try {
dateValue = DateFnsUtils.parseDate(this.value, this.dateDisplayFormat);
let dateWithProperFormat: string | Date;
if (typeof this.value === 'string') {
dateWithProperFormat = DateFnsUtils.formatDate(this.value, this.dateDisplayFormat);
} else {
dateWithProperFormat = this.value;
}
dateValue = DateFnsUtils.parseDate(dateWithProperFormat, this.dateDisplayFormat);
} catch {
dateValue = new Date('error');
}