1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-05 02:08:56 +09:00

Allow only one kind of date identifier at once (#5120)

This commit is contained in:
Satsuki Yanagi 2019-07-08 13:55:22 +09:00 committed by syuilo
parent 5343b005df
commit c2c06694da

View File

@ -42,7 +42,7 @@ function formatDateTimeString(date: Date, format: string): string {
}
export function formatTimeString(date: Date, format: string): string {
return format.replace(/\[(([^\[]|\[\])*)\]|([yMdHhmst]{1,4})/g, (match: string, localeformat?: string, unused?, datetimeformat?: string) => {
return format.replace(/\[(([^\[]|\[\])*)\]|(([yMdHhmst])\4{0,3})/g, (match: string, localeformat?: string, unused?, datetimeformat?: string) => {
if (localeformat) return formatLocaleString(date, localeformat);
if (datetimeformat) return formatDateTimeString(date, datetimeformat);
return match;