I try to change a date from Gregorian date to local date (Jalali). with this code:
document.write(new Date().toLocaleString("fa-IR"))
and it returns: ۱۴۰۱/۱۲/۲۲, ۱۱:۴۲:۰۰
But I need to be return output in English digits, like this: 1401/11/22, 11:42:00
>Solution :
In toLocaleString
the first option is preferred for language, if you want to have an Gregorian date with English digits you should use calendar option such as
console.log(new Date().toLocaleString("en" , {calendar: 'persian'}));