Skip to content

pakdatakit/format

Interface Description
ParsedAmount The result of parseAmount.
Function Description
formatPKR Formats a numeric amount as Pakistani Rupees with comma separators, rounded to whole rupees. Negative amounts are prefixed with -.
formatLakh Formats a numeric amount using Pakistani lakh/crore conventions.
parseAmount Reads a rupee amount the way people type it in Pakistan, and returns it in rupees, rounded half-up to the paisa. Returns null for anything that is not exactly one non-negative amount; it never throws.
formatAmountInput Writes back an amount typed in any form parseAmount accepts, for showing next to the field (“= Rs. 150,000”): Rs., international grouping, and paisa only when there are any (Rs. 1,234.50). Returns null when parseAmount does; it never throws.