Advanced
An order summary for any locale
The order summary hard-codes US formats. Make it follow the locale chosen in #locale (en-US uses USD, de-DE uses EUR, ja-JP uses JPY).
#total shows the amount 1234.5 formatted with Intl.NumberFormat as currency. #date shows the order date with Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC" }).
#items shows 1 item or N items in English, choosing the form with new Intl.PluralRules("en-US"). #more adds one item.
What Check tests
- With one item it says
1 item - With two items it says
2 items - en-US shows $1,234.50 and Jan 15, 2024
- de-DE shows euros and a German date
- ja-JP shows yen with no decimals
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.