diff --git a/CHANGELOG.md b/CHANGELOG.md
index b4307b6442..2fc4744b15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,7 @@ Our versioning strategy is as follows:
* `[templates/nextjs]` `[templates/react]` `[templates/vue]` `[templates/angular]` Changed formatting in temp/config to prevent parse issues in Unix systems ([#1787](https://github.com/Sitecore/jss/pull/1787))([#1791](https://github.com/Sitecore/jss/pull/1791))
* `[templates/nextjs-sxa]` The banner variant of image component is fixed with supporting metadata mode. ([#1826](https://github.com/Sitecore/jss/pull/1826))
+* `[sitecore-jss]` `[sitecore-jss-react]` DateField empty value is not treated as empty ([#1836](https://github.com/Sitecore/jss/pull/1836))
### 🎉 New Features & Improvements
diff --git a/packages/sitecore-jss-react/src/components/Date.test.tsx b/packages/sitecore-jss-react/src/components/Date.test.tsx
index d62d7f5e17..d2872c9360 100644
--- a/packages/sitecore-jss-react/src/components/Date.test.tsx
+++ b/packages/sitecore-jss-react/src/components/Date.test.tsx
@@ -4,6 +4,7 @@ import { mount, shallow } from 'enzyme';
import React from 'react';
import { DateField } from './Date';
import { describe } from 'node:test';
+import { EMPTY_DATE_FIELD_VALUE } from '@sitecore-jss/sitecore-jss/layout';
describe('${JSON.stringify(
- testMetadata
- )}
`,
- '[No text in field]',
- '',
- ].join('')
- );
- });
-
- it('should render custom empty field component when provided, when field value is empty', () => {
- const field = {
- value: '',
- metadata: testMetadata,
- };
-
- const EmptyFieldEditingComponent: React.FC = () => (
- Custom Empty field value
- );
-
- const rendered = mount(
-
${JSON.stringify(
- testMetadata
- )}
`,
- 'Custom Empty field value',
- '',
- ].join('')
- );
+ describe('empty value', () => {
+ describe('Should render default component', () => {
+ it('field value is empty string', () => {
+ const field = {
+ value: '',
+ metadata: testMetadata,
+ };
+
+ const rendered = mount(
${JSON.stringify(
+ testMetadata
+ )}
`,
+ '[No text in field]',
+ '',
+ ].join('')
+ );
+ });
+
+ it('field value is default empty date value', () => {
+ const field = {
+ value: EMPTY_DATE_FIELD_VALUE,
+ metadata: testMetadata,
+ };
+
+ const rendered = mount(
${JSON.stringify(
+ testMetadata
+ )}
`,
+ '[No text in field]',
+ '',
+ ].join('')
+ );
+ });
+ });
+
+ describe('Should render custom component', () => {
+ it('field value is empty string', () => {
+ const field = {
+ value: '',
+ metadata: testMetadata,
+ };
+
+ const EmptyFieldEditingComponent: React.FC = () => (
+ Custom Empty field value
+ );
+
+ const rendered = mount(
+
${JSON.stringify(
+ testMetadata
+ )}
`,
+ 'Custom Empty field value',
+ '',
+ ].join('')
+ );
+ });
+
+ it('field value is defaule empty date value', () => {
+ const field = {
+ value: EMPTY_DATE_FIELD_VALUE,
+ metadata: testMetadata,
+ };
+
+ const EmptyFieldEditingComponent: React.FC = () => (
+ Custom Empty field value
+ );
+
+ const rendered = mount(
+
${JSON.stringify(
+ testMetadata
+ )}
`,
+ 'Custom Empty field value',
+ '',
+ ].join('')
+ );
+ });
+ });
});
it('should render nothing when field value is empty, when editing is explicitly disabled ', () => {
diff --git a/packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.test.tsx b/packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.test.tsx
index 2cd08c9c60..0c03c34c17 100644
--- a/packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.test.tsx
+++ b/packages/sitecore-jss-react/src/enhancers/withEmptyFieldEditingComponent.test.tsx
@@ -5,6 +5,7 @@ import { mount } from 'enzyme';
import { withEmptyFieldEditingComponent } from './withEmptyFieldEditingComponent';
import { DefaultEmptyFieldEditingComponentText } from '../components/DefaultEmptyFieldEditingComponents';
import { describe } from 'node:test';
+import { EMPTY_DATE_FIELD_VALUE } from '@sitecore-jss/sitecore-jss/layout';
describe('withEmptyFieldEditingComponent', () => {
describe('Metadata', () => {
@@ -165,6 +166,65 @@ describe('withEmptyFieldEditingComponent', () => {
expect(rendered.html()).to.equal('
bar
bar