Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsUse Angular’s locale-aware pipes—DatePipe, CurrencyPipe, DecimalPipe, and PercentPipe—to format values in templates. Set the application’s LOCALE_ID for a consistent default, register locale data for locales beyond en-US, and pass explicit options when a date, currency, or number must render predictably. In application code outside a template, use Angular’s standalone formatting functions.
How Angular chooses a locale
Angular’s built-in date, currency, decimal, and percent pipes use locale conventions through LOCALE_ID. That token also affects ICU expressions. Angular documents en-US as the default; setting another locale is an application configuration choice, not an automatic consequence of a visitor’s browser language. See Angular’s LOCALE_ID API and locale ID guide.
As an Amazon Associate I earn from qualifying purchases.
Locale identifiers follow Unicode locale identifier conventions based on BCP 47 tags and CLDR. Choose the language and region that match the application’s requirements: en-US and en-CA are distinct locales, and may differ in punctuation, date conventions, number formatting, and grammar.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Set an application-wide default
Provide LOCALE_ID in the application’s providers to make a locale the default for Angular’s locale-aware formatting and ICU expressions. For example, in a standalone application’s provider configuration:
#1 Best Overall
import { LOCALE_ID } from '@angular/core';
providers: [
{ provide: LOCALE_ID, useValue: 'fr' }
]
Use the locale ID your application actually targets. Changing the token does not by itself add the locale’s formatting data to the application.
Format values in a template
Use a pipe whose value type matches the output you need. Angular’s locale formatting guide documents these pipes and their locale behavior.
Rank #2
| Value | Template example | What to specify |
|---|---|---|
| Date or time | {{ today | date }} |
Choose a format and timezone when defaults are not suitable. |
| Currency | {{ amount | currency:'USD':'symbol':'1.2-2':'en-US' }} |
Pass the currency code separately from the locale; set display and precision as needed. |
| Decimal number | {{ value | number:'1.0-3':'fr' }} |
The digit pattern controls integer and fraction digits; the locale controls separators and grouping. |
| Percentage | {{ rate | percent }} |
Use the locale-aware percent pipe; choose explicit formatting options when required. |
The examples show pipe syntax; output punctuation and symbols follow the selected locale and options. For the exact argument definitions, see Angular’s DecimalPipe and CurrencyPipe APIs.
Control decimal precision
DecimalPipe accepts digit settings in the form {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}. For example, 1.0-3 requests at least one integer digit, allows no required fraction digits, and permits up to three fraction digits. Supply an explicit locale argument when the value should not rely on the application default.
Rank #3
Keep currency and locale separate
A locale describes formatting conventions; it does not decide what currency an amount represents. Pass the intended currency code, such as USD or CAD, as a separate argument. Currency fraction digits differ by currency, so set digit options when the display must follow a particular application requirement rather than relying on currency defaults. The locale argument on CurrencyPipe can override the application’s LOCALE_ID.
Register locale data for other locales
Angular includes only en-US locale data by default. For another date locale, import its locale data and register it with registerLocaleData before relying on localized date formatting. The registerLocaleData API documents registration, and the DatePipe API notes the default-data limitation.
Rank #4
import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
registerLocaleData(localeFr);
Register the data corresponding to the locale you intend to use. Setting LOCALE_ID and registering locale data solve different parts of configuration: the former selects a default locale; the latter makes additional locale data available.
Make date output predictable
DatePipe accepts a date value, format, timezone, and locale. If you omit the timezone, Angular uses configured default options or the host system timezone; consequently, the same instant may display with a different calendar date or time in different environments. Supply a timezone when output must be consistent. The DatePipe API describes the parameters and behavior.
DatePipe is pure. If you mutate an existing Date object in place, Angular does not rerun the pipe. Replace it with a new Date object reference when the displayed date changes.
Format values outside templates
In a service or other TypeScript code, use Angular’s standalone functions from @angular/common rather than injecting a pipe class. The available functions are formatDate, formatCurrency, formatNumber, and formatPercent. Choose the function that matches the value and pass the locale and other options required by that call. Angular’s pipes guide recommends these functions for formatting outside templates.
Choose the right configuration
- Use
LOCALE_IDwhen the application needs one locale as its default across built-in pipes and ICU expressions. - Use a per-call locale when a particular output needs a locale different from the application default, where the pipe or function supports that argument.
- Register locale data when formatting with a locale beyond Angular’s built-in
en-USdata, especially for dates. - Set explicit options for currencies, precision, formats, or timezones whenever defaults could make the output ambiguous or environment-dependent.
- Use a pipe in a template and a formatting function in code to keep the approach appropriate to the execution context.
For broader application localization beyond formatting values, see Angular’s internationalization guide.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




