diff --git a/packages/field/src/InteractionStateMixin.js b/packages/field/src/InteractionStateMixin.js index 91a2e02a1..9e7deb32d 100644 --- a/packages/field/src/InteractionStateMixin.js +++ b/packages/field/src/InteractionStateMixin.js @@ -60,7 +60,7 @@ export const InteractionStateMixin = dedupeMixin( value = modelValue.viewValue; } // Checks for empty platform types: Objects, Arrays, Dates - if (typeof value === 'object' && value !== null) { + if (typeof value === 'object' && value !== null && !(value instanceof Date)) { return !!Object.keys(value).length; } // eslint-disable-next-line no-mixed-operators diff --git a/packages/field/test-suites/InteractionStateMixin.suite.js b/packages/field/test-suites/InteractionStateMixin.suite.js index 8d6cff351..2c7b3b7b4 100644 --- a/packages/field/test-suites/InteractionStateMixin.suite.js +++ b/packages/field/test-suites/InteractionStateMixin.suite.js @@ -14,7 +14,7 @@ import { InteractionStateMixin } from '../src/InteractionStateMixin.js'; export function runInteractionStateMixinSuite(customConfig) { const cfg = { tagString: null, - allowedModelValueTypes: [Array, Object, Number, Boolean, String], + allowedModelValueTypes: [Array, Object, Number, Boolean, String, Date], suffix: '', ...customConfig, }; @@ -154,6 +154,10 @@ export function runInteractionStateMixinSuite(customConfig) { changeModelValueAndLeave(''); expect(el.prefilled, 'empty string should not be "prefilled"').to.be.false; } + if (cfg.allowedModelValueTypes.includes(Date)) { + changeModelValueAndLeave(new Date()); + expect(el.prefilled, 'Dates should be "prefilled"').to.be.true; + } // Not prefilled changeModelValueAndLeave(null);