Normalize Persian Digits
Persian keyboards commonly type ۰-۹ (or Arabic-Indic ٠-٩) instead of 0-9. This utility converts either set back to plain digits, so numeric inputs and parsers keep working regardless of which keyboard the user is on. Price Input uses it internally.
Last updated January 1, 1980
Overview
Type Persian or Arabic-Indic digits above; the normalized result updates below as you type.
Installation
Usage
import { normalizePersianDigits } from "@/lib/normalize-persian-digits"
normalizePersianDigits("۱۲۳۴۵") // "12345"
normalizePersianDigits("قیمت ٤٥٠") // "قیمت 450"