What you are looking for is to format a Date with an Arabic Locale (i.e. Arabic text) but with Latin (English) Numbers (or any other numbering system of your choice).
Please note that when using the Arabic Language locales the numbering system will default to the Arabic-Eastern numbers for ALL Arabic Locales (i.e. the numbers "٠١٢٣٤٥٦٧٨٩"
EXCEPT for five (5) Arabic locales that will use the Arabic-Western (Latin) Numbers 0123456789
; these are ar-DZ
, ar-EH
, ar-LY
, ar-MA
, and ar-TN
locales.
As you are using ar-SA
for Saudi Arabia the date will default to using the Arabic-Eastern Numbers "٠١٢٣٤٥٦٧٨٩"
.
You can change to using the Arabic-Western (Latin) Numbers 0123456789
irrespective of the locale used by either:
1. Specify latn
as Unicode numbering system in the locale.
new Intl.DateTimeFormat('ar-SA-u-nu-latn',{month:'short',day:'numeric' }).format(new Date());
OR
2. Specify latn
as a numbering system options.
new Intl.DateTimeFormat('ar-SA',{month:'short',day:'numeric',numberingSystem:'latn'}).format(new Date());
In either case, you will output an Arabic String but with English (Arabic-Western Numbers).
**There are other numbering systems that you can use**:
"arab", "arabext", " bali", "beng", "deva", "fullwide",
" gujr", "guru", "hanidec", "khmr", " knda", "laoo",
"latn", "limb", "mlym", " mong", "mymr", "orya",
"tamldec", " telu", "thai", "tibt".
Here is an example.
console.log(new Intl.DateTimeFormat('ar-SA-u-nu-latn',{month:'short',day:'numeric'}).format(new Date()));
console.log(new Intl.DateTimeFormat('ar-SA',{month:'short',day:'numeric',numberingSystem:'latn'}).format(new Date()));
console.log(new Intl.DateTimeFormat('ar-SA',{dateStyle: 'full',numberingSystem:'latn'}).format(new Date()));