Intl and locale formatting quirks
Reads Intl resolved options and formatting outputs for many locales and calendars.
In one line
Can check language, calendar and number format settings to spot your browser build
Reads Intl resolved options and formatting outputs for many locales and calendars.
Beyond timezone and language, ICU data version, supported calendars and numbering systems differ per browser build and OS, enabling version and cloak detection.
What it can and can't do
What the user does: Nothing. It happens when the page loads
It can
- Test how your browser formats dates, numbers and money in many languages
- Learn which calendars and numbering systems it supports
- Learn your browser build and system from the differences
- Spot tools that fake your language or time zone
It cannot
- See what you typed or saved
- Ask permission first
- Know who you are by itself
- Tell your exact location, only your language and time zone settings
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 24 | 2013-01-10 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 29 | 2014-04-29 | None |
| Safari | Supported | 10 | 2016-09-20 | None |
| Safari on iPhone | Supported | 10 | 2016-09-13 | None |
| Chrome on Android | Supported | 25 | 2013-02-27 | None |
| Samsung Internet | Supported | 1.5 | 2013-09-25 | None |
How a site asks for it
| API | Intl.DateTimeFormat().resolvedOptions(); Intl.supportedValuesOf(); toLocaleString(); Intl.DisplayNames |
| Browser compat keys | javascript.builtins.Intl.DateTimeFormat.resolvedOptions |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Read resolvedOptions.timeZone, locale, calendar, numberingSystem
- Format a fixed date in a dozen locales
- Compare ICU outputs
Data you get
What comes back: About 10 strings plus formatted samples
Shape: object
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
timeZone | string | IANA | about 420 zones | exact |
calendar | enum | None | gregory, buddhist, ... | exact |
numberingSystem | enum | None | latn, arab, ... | exact |
Technical limits
- Timezone also available via Date, so not an extra bit alone
The story
What it is
A script reads how your browser formats dates, numbers and languages to learn your locale and engine details.
For you
You never see it. Sites use it to show prices, dates and numbers the way you expect, like 1,000.50 or 1.000,50. A quieter side effect is that the output reveals your region, calendar and browser.
For makers
Shops and apps need it to show correct local formats. Fraud tools compare your formats with your IP location, and trackers add them to a device ID.
Where you see it
| Type | Example | Apps |
|---|---|---|
| shopping | A store shows prices in your currency with the right commas and symbols. | Amazon, IKEA |
| travel | A booking site shows dates in your local order, day then month or month then day. | Booking.com, Airbnb |
| security | A bank notices a login claiming a Japanese locale from an IP in another country and asks extra questions. | None named |
| analytics | A fingerprint library records the time zone and calendar your browser reports. | FingerprintJS |
| ads | An ad network targets by language and region read from locale settings. | None named |
| games | A browser game with a leaderboard shows scores and dates in your local format. | None named |
| news | A news site picks the right language edition from locale data. | None named |
Risks
- Reveals region and language
- Adds to a device ID
What the platform says
- MDN: Intl. Built in tools that format dates, numbers and text correctly for each language and region.
Good uses and abuse
Legitimate uses
- Format dates and numbers locally
Known abuse
- Locale and ICU version pinning, VPN versus timezone mismatch
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 3 of 5 | How revealing the data is |
| Utility | 2 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 4 | Rough identifying entropy, when known |
Related capabilities
Related
- Time zone and UTC offset. Can tell your time zone, roughly which region you are in
- Error message and stack formats. Can trigger small errors to learn which browser engine you really use
Sources
How well checked: Based on official documentation.