JavaScript Date Formatting — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Date Formatting lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Format for British readers
easy10 minFormat the date in the British order.
- 2
Format for American readers
easy10 minFormat the same date in the American order.
- 3
Use a long month name
easy10 minShow the date with the month spelled out.
- 4
Get the ISO date
easy10 minReport just the date part of the ISO string.
- 5
Reuse a formatter
medium10 minBuild one Intl formatter and format a date with it.
Find the bug(5)
- 1
Fix the date built by hand
easy8 minJoining the parts gets the order and padding wrong.
- 2
Fix the wrong locale
easy8 minThe British order puts the day first.
- 3
Fix the ISO string shown in full
easy8 minOnly the date part is wanted, not the time as well.
- 4
Fix the short month wanted long
easy8 minThe option should spell the month out.
- 5
Fix the missing timeZone option
easy8 minWithout it the result depends on where the code runs.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace