String.prototype.EntoFa= function() {
return this.replace(/\d/g, d => '۰۱۲۳۴۵۶۷۸۹'[d])
}
String.prototype.EntoAr= function() {
return this.replace(/\d/g, d => '٠١٢٣٤٥٦٧٨٩'[d])
}
String.prototype.ArtoEn= function() {
return this.replace(/[\u0660-\u0669]/g,
d => d.charCodeAt() - 1632)
}
String.prototype.PetoEn= function() {
return this.replace(/[\u06F0-\u06F9]/g,
d => d.charCodeAt() - 1776)
}
String.prototype.PetoAr= function() {
return this.replace(/[\u06F0-\u06F9]/g,
d => '٠١٢٣٤٥٦٧٨٩'[d.charCodeAt() - 1776])
}
String.prototype.ArtoPe= function() {
return this.replace(/[\u0660-\u0669]/g,
d => '۰۱۲۳۴۵۶۷۸۹'[d.charCodeAt() - 1632])
}
String.prototype.IntoEn= function() {
return this.replace(/[\u06F0-\u06F9\u0660-\u0669]/g,
d => ((c=d.charCodeAt()) > 1775 ? c - 1776 : c - 1632))
}
String.prototype.EntoIn= function(e) {
return this.replace(/\d/g,
d => e ? '٠١٢٣٤٥٦٧٨٩'[d] : '۰۱۲۳۴۵۶۷۸۹'[d])
}
String.prototype.EntoFaUni= function() {
return this.replace(/\d/g, d => String.fromCharCode('0x06F'+d))
}
String.prototype.EntoArUni= function() {
return this.replace(/\d/g, d => String.fromCharCode('0x066'+d))
}
String.prototype.EntoInUni= function(e) {
return this.replace(/\d/g, d => String.fromCharCode('0x06'+(e ? '6':'F')+d))
}
let En = 'It is 30/08/2018 at 8:24 AM'
let Pe = 'It is ۳۰/۰۸/۲۰۱۹ at ۸:۲۴ AM'
let Ar = 'It is ٣٠/٠٨/٢٠١٩ at ٨:٢٤ AM'
let PeAr = 'It is ۳۰/۰۸/۲۰۱۹ at ۸:۲۴ | AM It is ٣٠/٠٨/٢٠١٩ at ٨:٢٤ AM'
console.log(Ar.ArtoEn())
console.log(Pe.PetoEn())
console.log(Pe.PetoAr())
console.log(Ar.ArtoPe())
console.log(PeAr.IntoEn())
console.log(En.EntoFa())
console.log(En.EntoAr())
console.log(En.EntoIn(0))
console.log(En.EntoIn(1))
console.log(En.EntoFaUni())
console.log(En.EntoArUni())
console.log(En.EntoInUni(0))
console.log(En.EntoInUni(1))
Run code snippet