From b2a6854a922f006f4d7f7fb4a20246ad5c4d2c07 Mon Sep 17 00:00:00 2001 From: Sergei Leshchina Date: Tue, 23 Jul 2024 01:59:29 +0300 Subject: [PATCH] Process dates with Eastern Arabic and Persian numbers --- src/parser/time.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/parser/time.ts b/src/parser/time.ts index bd5e155..bba987a 100644 --- a/src/parser/time.ts +++ b/src/parser/time.ts @@ -213,6 +213,8 @@ export function createTimeValue( timestamp: string, forceJulian?: boolean ): Tim forceJulian = true; } timestamp = timestamp.replace( /\([^)]*\)/, '' ).trim(); + timestamp.replace( /[٠-٩]/g, ( d: string ) => '٠١٢٣٤٥٦٧٨٩'.indexOf( d ).toString() ); // Eastern Arabic + timestamp.replace( /[۰-۹]/g, ( d: string ) => '۰۱۲۳۴۵۶۷۸۹'.indexOf( d ).toString() ); // Persian let isBce: boolean = false; const bceMatch: RegExpMatchArray = timestamp.match( getConfig( 're-bce' ) );