Can anyone help me to change Gregorian date to Persian in JavaScript? I want to use it in HTML and JavaScript.
To get it in Persian digits:
new Date().toLocaleDateString('fa-IR'); // ۱۳۹۹/۱/۲۳
To get it in Latin digits:
new Date().toLocaleDateString('fa-IR').replace(/([۰-۹])/g, token => String.fromCharCode(token.charCodeAt(0) - 1728)); // 1399/1/23