From c6a6df373a6ee7b446fe9030070e331ca562b65d Mon Sep 17 00:00:00 2001 From: pwespi Date: Tue, 15 May 2018 19:45:48 +0200 Subject: [PATCH 1/2] fix(datetime): allow values to be zero --- core/src/components/datetime/datetime-util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/components/datetime/datetime-util.ts b/core/src/components/datetime/datetime-util.ts index 90975c1b618..258d70fd80d 100644 --- a/core/src/components/datetime/datetime-util.ts +++ b/core/src/components/datetime/datetime-util.ts @@ -11,7 +11,7 @@ export function renderDatetime(template: string, value: DatetimeData, locale: Lo const token = '{' + index + '}'; const text = renderTextFormat(format.f, (value as any)[format.k], value, locale); - if (!hasText && text && (value as any)[format.k]) { + if (!hasText && text && ((value as any)[format.k] || (value as any)[format.k] === 0)) { hasText = true; } From 17db50fd52cb29a37999cdcaba12bba0467e96ec Mon Sep 17 00:00:00 2001 From: Manu MA Date: Fri, 24 Aug 2018 04:27:34 +0200 Subject: [PATCH 2/2] Using null check --- core/src/components/datetime/datetime-util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/components/datetime/datetime-util.ts b/core/src/components/datetime/datetime-util.ts index 258d70fd80d..61f584cf5f1 100644 --- a/core/src/components/datetime/datetime-util.ts +++ b/core/src/components/datetime/datetime-util.ts @@ -11,7 +11,7 @@ export function renderDatetime(template: string, value: DatetimeData, locale: Lo const token = '{' + index + '}'; const text = renderTextFormat(format.f, (value as any)[format.k], value, locale); - if (!hasText && text && ((value as any)[format.k] || (value as any)[format.k] === 0)) { + if (!hasText && text && (value as any)[format.k] != null) { hasText = true; }