Skip to content

Commit

Permalink
fix(useDateFormat): can't return zero value
Browse files Browse the repository at this point in the history
  • Loading branch information
JocelynFloresz committed Jul 30, 2023
1 parent 296dcc5 commit a979f21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/shared/useDateFormat/index.ts
Original file line number Diff line number Diff line change
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]?.() || match)
return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 ?? matches[match]?.() ?? match)
}

export function normalizeDate(date: DateLike) {
Expand Down

0 comments on commit a979f21

Please sign in to comment.