From 6cfa301d1cd0aa06a5fd946f6ea2e2429fd0a56a Mon Sep 17 00:00:00 2001 From: Thijs Louisse Date: Wed, 15 May 2019 16:59:34 +0200 Subject: [PATCH] fix(localize): empty dates should be formatted as empty string --- packages/localize/src/date/formatDate.js | 2 +- packages/localize/test/date/formatDate.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/localize/src/date/formatDate.js b/packages/localize/src/date/formatDate.js index c544ab8ec..3353a7989 100644 --- a/packages/localize/src/date/formatDate.js +++ b/packages/localize/src/date/formatDate.js @@ -10,7 +10,7 @@ import { normalizeDate } from './normalizeDate.js'; */ export function formatDate(date, options) { if (!(date instanceof Date)) { - return '0000-00-00'; + return ''; } const formatOptions = options || {}; // make sure months and days are always 2-digits diff --git a/packages/localize/test/date/formatDate.test.js b/packages/localize/test/date/formatDate.test.js index 4efd8a8d1..1acb2a62b 100644 --- a/packages/localize/test/date/formatDate.test.js +++ b/packages/localize/test/date/formatDate.test.js @@ -108,8 +108,8 @@ describe('formatDate', () => { expect(formatDate(parsedDate, options)).to.equal('maandag 01 januari 1940'); }); - it('returns a zero-date when input is not a Date object', async () => { + it('returns empty string when input is not a Date object', async () => { const date = '1-1-2016'; - expect(formatDate(date)).to.equal('0000-00-00'); + expect(formatDate(date)).to.equal(''); }); });