Skip to content

Commit cfd78bd

Browse files
committed
fix(field): added Date support to InteractionStateMixin
1 parent 22bb75a commit cfd78bd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/field/src/InteractionStateMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const InteractionStateMixin = dedupeMixin(
6060
value = modelValue.viewValue;
6161
}
6262
// Checks for empty platform types: Objects, Arrays, Dates
63-
if (typeof value === 'object' && value !== null) {
63+
if (typeof value === 'object' && value !== null && !(value instanceof Date)) {
6464
return !!Object.keys(value).length;
6565
}
6666
// eslint-disable-next-line no-mixed-operators

packages/field/test-suites/InteractionStateMixin.suite.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { InteractionStateMixin } from '../src/InteractionStateMixin.js';
1414
export function runInteractionStateMixinSuite(customConfig) {
1515
const cfg = {
1616
tagString: null,
17-
allowedModelValueTypes: [Array, Object, Number, Boolean, String],
17+
allowedModelValueTypes: [Array, Object, Number, Boolean, String, Date],
1818
suffix: '',
1919
...customConfig,
2020
};
@@ -154,6 +154,10 @@ export function runInteractionStateMixinSuite(customConfig) {
154154
changeModelValueAndLeave('');
155155
expect(el.prefilled, 'empty string should not be "prefilled"').to.be.false;
156156
}
157+
if (cfg.allowedModelValueTypes.includes(Date)) {
158+
changeModelValueAndLeave(new Date());
159+
expect(el.prefilled, 'Dates should be "prefilled"').to.be.true;
160+
}
157161

158162
// Not prefilled
159163
changeModelValueAndLeave(null);

0 commit comments

Comments
 (0)