From a2147fdd0d6b35c1066f690c1107a26002bda8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20=C4=8Camd=C5=BEi=C4=87?= Date: Thu, 20 Apr 2023 17:19:43 +0200 Subject: [PATCH] fix(useDateFormat): Error if Y or YYY provided (#3001) Co-authored-by: Dino Camdzic --- packages/shared/useDateFormat/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/useDateFormat/index.ts b/packages/shared/useDateFormat/index.ts index 687b6b94c2c..a7ecb9fa836 100644 --- a/packages/shared/useDateFormat/index.ts +++ b/packages/shared/useDateFormat/index.ts @@ -66,7 +66,7 @@ export function formatDate(date: Date, formatStr: string, options: UseDateFormat a: () => meridiem(hours, minutes, true), aa: () => meridiem(hours, minutes, true, true), } - return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]()) + return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]?.() || match) } export function normalizeDate(date: DateLike) {