Skip to content

Commit

Permalink
fix(rules): handle some unwanted characters in date
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Aug 10, 2024
1 parent 79a5021 commit 3a63880
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/common/date_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 3a63880

Please sign in to comment.