Skip to main content

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. 1

    Format for British readers

    easy10 min

    Format the date in the British order.

  2. 2

    Format for American readers

    easy10 min

    Format the same date in the American order.

  3. 3

    Use a long month name

    easy10 min

    Show the date with the month spelled out.

  4. 4

    Get the ISO date

    easy10 min

    Report just the date part of the ISO string.

  5. 5

    Reuse a formatter

    medium10 min

    Build one Intl formatter and format a date with it.

Find the bug(5)

  1. 1

    Fix the date built by hand

    easy8 min

    Joining the parts gets the order and padding wrong.

  2. 2

    Fix the wrong locale

    easy8 min

    The British order puts the day first.

  3. 3

    Fix the ISO string shown in full

    easy8 min

    Only the date part is wanted, not the time as well.

  4. 4

    Fix the short month wanted long

    easy8 min

    The option should spell the month out.

  5. 5

    Fix the missing timeZone option

    easy8 min

    Without 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