Check families

Dates, numbers and currency: what the check looks for and how to fix it

The checks that find hand-built dates, numbers and prices that read wrongly in another market, what they flag, and the formatter that replaces each.

Check families · 2 min readMarkdown
On this page

3/4/2027 is the 3rd of April in Mexico and the 4th of March in the United States. 1.299,00 is one thousand two hundred and ninety-nine in Germany and a misprint in the United States. A date or a price that you assemble from parts is right for one market and wrong for the next. The fix is the platform's own formatter, with the user's locale.

The checks

CheckWhat it looks forMeasured status
CHK-CORE-008Currency symbols or numbers joined into text by hand instead of a number or currency formatterproduction
CHK-CORE-009Fixed date and time patterns such as MM/DD/YYYY instead of locale-aware formattingproduction

Run it

npx threefold check . --markets es-MX,de-DE,ja-JP

If npx reports that the package does not exist, it has not been published yet: the i18n check page and the guides say what works meanwhile.

The formatter to use

WhereDatesNumbers and currency
Web and React NativeIntl.DateTimeFormat(locale, options)Intl.NumberFormat(locale, { style: "currency", currency })
iOSDate.FormatStyle or DateFormatter with the user's LocaleFormatStyle or NumberFormatter with currencyCode
AndroidDateFormat.getDateInstance or java.time formattersNumberFormat.getCurrencyInstance(locale)
FlutterDateFormat from intlNumberFormat.currency(locale: ...)

Currency is a pricing decision too

A formatter prints a number the way a market reads it. It does not choose the price. The local pricing benchmark turns one price into ten markets at the exchange rate and at purchasing power, with the local ending (99 for pesos, 80 for yen).

What it cannot tell

It finds patterns in source files. It does not see text that is built on a server, or a number a formatter received in the wrong currency. Run the app in each locale and read the screens.

Guide

Check date and number formatting.

Questions

Is toLocaleString() enough?

With the user's locale and the options for a currency, yes. Called with no arguments it uses the runtime's locale, which on a server is rarely the user's.

Who decides the currency?

Your pricing: the formatter only displays it.

All check familiesGuides