Skip to content

Commit 6cfa301

Browse files
tlouissedaKmoR
authored andcommitted
fix(localize): empty dates should be formatted as empty string
1 parent 5255b1b commit 6cfa301

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/localize/src/date/formatDate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { normalizeDate } from './normalizeDate.js';
1010
*/
1111
export function formatDate(date, options) {
1212
if (!(date instanceof Date)) {
13-
return '0000-00-00';
13+
return '';
1414
}
1515
const formatOptions = options || {};
1616
// make sure months and days are always 2-digits

packages/localize/test/date/formatDate.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ describe('formatDate', () => {
108108
expect(formatDate(parsedDate, options)).to.equal('maandag 01 januari 1940');
109109
});
110110

111-
it('returns a zero-date when input is not a Date object', async () => {
111+
it('returns empty string when input is not a Date object', async () => {
112112
const date = '1-1-2016';
113-
expect(formatDate(date)).to.equal('0000-00-00');
113+
expect(formatDate(date)).to.equal('');
114114
});
115115
});

0 commit comments

Comments
 (0)