diff --git a/src/core/watcher-helper.ts b/src/core/watcher-helper.ts index 4c543754d..2e1a441f3 100644 --- a/src/core/watcher-helper.ts +++ b/src/core/watcher-helper.ts @@ -39,7 +39,10 @@ export class WatcherHelper { } private _isDifferentValues(oldValue: any, newValue: any, deepCheck: boolean) { - if (deepCheck && newValue instanceof (Object) && oldValue instanceof (Object)) { + let isObjectValues = newValue instanceof Object && oldValue instanceof Object, + isDateValues = oldValue instanceof Date && newValue instanceof Date; + + if (deepCheck && isObjectValues && !isDateValues) { return this._checkObjectsFields(newValue, oldValue); } return oldValue !== newValue; diff --git a/tests/src/ui/form.spec.ts b/tests/src/ui/form.spec.ts index cf6040389..21558fe91 100644 --- a/tests/src/ui/form.spec.ts +++ b/tests/src/ui/form.spec.ts @@ -25,7 +25,8 @@ import { }) class TestContainerComponent { formData = { - name: 'Unknown' + name: 'Unknown', + date: new Date() }; @ViewChildren(DxFormComponent) innerWidgets: QueryList; } @@ -114,4 +115,25 @@ describe('DxForm', () => { expect(formInstance.option('formData.name')).toEqual([2]); })); + + it('should change the value of dxDateBox', async(() => { + TestBed.overrideComponent(TestContainerComponent, { + set: { + template: ` + + + ` + } + }); + let fixture = TestBed.createComponent(TestContainerComponent); + fixture.detectChanges(); + + fixture.componentInstance.formData.date = new Date(2017, 0, 1); + fixture.detectChanges(); + + let formInstance = getWidget(fixture); + let dateBoxInstance = formInstance.getEditor('date'); + + expect(dateBoxInstance.option('value')).toEqual(new Date(2017, 0, 1)); + })); });