Skip to content

Commit

Permalink
fix(useDateFormat): Error if Y or YYY provided (#3001)
Browse files Browse the repository at this point in the history
Co-authored-by: Dino Camdzic <dinoc@bicomsystems.com>
  • Loading branch information
dinocam1 and Dino Camdzic committed Apr 20, 2023
1 parent 07ebe33 commit a2147fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/shared/useDateFormat/index.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit a2147fd

Please sign in to comment.