]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Fix tests
authorKunal Marwaha <marwahaha@berkeley.edu>
Wed, 17 Jun 2020 09:57:49 +0000 (02:57 -0700)
committerIskren Chernev <me@iskren.info>
Sat, 23 Dec 2023 10:21:58 +0000 (12:21 +0200)
src/locale/ar-ps.js

index 4f4112481349a5833952ba39b49a463971d7dd72..edd8be08c149d1ea8ca46f3320066765eaaf7d58 100644 (file)
@@ -85,9 +85,18 @@ export default moment.defineLocale('ar-ps', {
     },
     preparse: function (string) {
         return string
-            .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
+            .replace(/[٣٤٥٦٧٨٩٠]/g, function (match) {
                 return numberMap[match];
             })
+            .split('') // reversed since negative lookbehind not supported everywhere
+            .reverse()
+            .join('')
+            .replace(/[١٢](?![\u062a\u0643])/g, function (match) {
+                return numberMap[match];
+            })
+            .split('')
+            .reverse()
+            .join('')
             .replace(/،/g, ',');
     },
     postformat: function (string) {