Internationalizing Dates, Numbers, Currencies (i18n Pipes)
14.6 Internationalizing Dates, Numbers, Currencies (i18n Pipes)
Section titled “14.6 Internationalizing Dates, Numbers, Currencies (i18n Pipes)”Angular provides built-in pipes for locale-sensitive formatting.
TypeScript (component):
import { Component, signal } from "@angular/core";
@Component({ selector: "app-format-example", standalone: true, templateUrl: "./format-example.component.html",})export class FormatExampleComponent { amount = signal(1234.56); date = signal(new Date());}HTML template:
<p>Currency: {{ amount() | currency:'EUR':'symbol':'1.2-2':'fr' }}</p><p>Date: {{ date() | date:'fullDate':'':'fr' }}</p>Explanation:
currencypipe formats numbers as currencydatepipe formats dates per localefrsets French formatting