mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Fix datewidget's moment issue (#2384)
This commit is contained in:
parent
2651f17a14
commit
9af78dc240
@ -114,7 +114,7 @@ describe('DateWidgetComponent', () => {
|
||||
|
||||
widget.field = field;
|
||||
|
||||
widget.onDateChanged('12/12/2012');
|
||||
widget.onDateChanged({ value: moment('12/12/2012') });
|
||||
expect(widget.checkVisibility).toHaveBeenCalledWith(field);
|
||||
});
|
||||
|
||||
|
@ -60,7 +60,7 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
this.displayDate = moment(this.field.value, this.field.dateDisplayFormat, true);
|
||||
this.displayDate = moment(this.field.value, this.field.dateDisplayFormat);
|
||||
|
||||
}
|
||||
|
||||
@ -68,13 +68,13 @@ export class DateWidgetComponent extends WidgetComponent implements OnInit {
|
||||
this.field.validationSummary = '';
|
||||
|
||||
if (newDateValue) {
|
||||
let momentDate = moment(newDateValue, this.field.dateDisplayFormat, true);
|
||||
let momentDate = newDateValue.value;
|
||||
if (!momentDate.isValid()) {
|
||||
this.field.validationSummary = this.field.dateDisplayFormat;
|
||||
this.field.value = null;
|
||||
} else {
|
||||
this.field.value = newDateValue;
|
||||
this.displayDate = moment(this.field.value, this.field.dateDisplayFormat, true);
|
||||
this.field.value = momentDate;
|
||||
this.displayDate = moment(this.field.value, this.field.dateDisplayFormat);
|
||||
}
|
||||
} else {
|
||||
this.field.value = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user