# 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.

`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

| Check | What it looks for | Measured status |
|---|---|---|
| `CHK-CORE-008` | Currency symbols or numbers joined into text by hand instead of a number or currency formatter | production |
| `CHK-CORE-009` | Fixed date and time patterns such as `MM/DD/YYYY` instead of locale-aware formatting | production |

## Run it

```sh
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](https://threefold.eco/i18n-check/) and the guides say what works meanwhile.

## The formatter to use

| Where | Dates | Numbers and currency |
|---|---|---|
| Web and React Native | `Intl.DateTimeFormat(locale, options)` | `Intl.NumberFormat(locale, { style: "currency", currency })` |
| iOS | `Date.FormatStyle` or `DateFormatter` with the user's `Locale` | `FormatStyle` or `NumberFormatter` with `currencyCode` |
| Android | `DateFormat.getDateInstance` or `java.time` formatters | `NumberFormat.getCurrencyInstance(locale)` |
| Flutter | `DateFormat` from `intl` | `NumberFormat.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](https://threefold.eco/tools/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](https://threefold.eco/guides/check-date-and-number-formatting.md).

## 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.
