From c2c06694daa69e4638af82b17f40b7d20989638a Mon Sep 17 00:00:00 2001 From: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com> Date: Mon, 8 Jul 2019 13:55:22 +0900 Subject: [PATCH] Allow only one kind of date identifier at once (#5120) --- src/misc/format-time-string.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc/format-time-string.ts b/src/misc/format-time-string.ts index 4729036e5..caa31780b 100644 --- a/src/misc/format-time-string.ts +++ b/src/misc/format-time-string.ts @@ -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;