Skip to content

Commit 74b504a

Browse files
author
NarrowsProjects
committed
feat: only notify models if both time and date have been provided.
1 parent 1333378 commit 74b504a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/public/components/common/form/inputs/DateTimeInputModel.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ export class DateTimeInputModel extends Observable {
6565
*/
6666
update(raw) {
6767
this._raw = raw;
68+
const hasDateAndTime = raw.date && raw.time;
69+
6870
try {
69-
this._value = raw.date && raw.time ? extractTimestampFromDateTimeInput(raw, { seconds: this._seconds }) : null;
71+
this._value = hasDateAndTime ? extractTimestampFromDateTimeInput(raw, { seconds: this._seconds }) : null;
7072
} catch {
7173
this._value = null;
7274
}
7375

74-
this.notify();
76+
hasDateAndTime && this.notify();
7577
}
7678

7779
/**

0 commit comments

Comments
 (0)