From 3a6388086707142314d87bdc607d809e9abd01d1 Mon Sep 17 00:00:00 2001 From: rhahao <26148770+rhahao@users.noreply.github.com> Date: Sat, 10 Aug 2024 17:56:14 +0300 Subject: [PATCH] fix(rules): handle some unwanted characters in date --- src/common/date_parser.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/date_parser.ts b/src/common/date_parser.ts index d9a0d515..dc03324f 100644 --- a/src/common/date_parser.ts +++ b/src/common/date_parser.ts @@ -125,7 +125,12 @@ const mwbDateParsing: MWBDateParsing = { // #endregion export const extractMWBDate = (src: string, year: number, lang: string) => { - const srcClean = src.trim().replace(' ', ' ').replace('​', '').replace('⁠', ''); + const srcClean = src + .trim() + .replace(' ', ' ') + .replace('​', '') + .replace('⁠', '') + .replace(/\u200F/g, ''); const datePattern = mwbDatePatterns[lang] || mwbDatePatterns.common; @@ -332,7 +337,12 @@ const wDateParsing: WDateParsing = { // #endregion export const extractWTStudyDate = (src: string, lang: string) => { - const srcClean = src.trim().replace(' ', ' ').replace('​', ''); + const srcClean = src + .trim() + .replace(' ', ' ') + .replace('​', '') + .replace('⁠', '') + .replace(/\u200F/g, ''); const datePattern = wDatePatterns[lang] || wDatePatterns.common;