Skip to content

Instantly share code, notes, and snippets.

@beygi
Last active May 14, 2019 13:14
Show Gist options
  • Save beygi/e0c38acee82277e28b663b8eef0a2a91 to your computer and use it in GitHub Desktop.
Save beygi/e0c38acee82277e28b663b8eef0a2a91 to your computer and use it in GitHub Desktop.
world's shortest function to convert english numbers to persian equivalent

Definition

c=(s)=>s.replace(/\d/g,x=>"۰۱۲۳۴۵۶۷۸۹".split("")[x]);

Usage:

console.log(c("2003/08/12")); //۲۰۰۳/۰۸/۱۲
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment