Command Palette

Search for a command to run...

Hectal
Phase 8: Interaction
Data Visualization · Exercise 4 of 4 Previous
Advanced

Read a date range from the URL

Write parseRange(hash). It gets text such as #from=2025-06-01&to=2025-06-30 and returns ["2025-06-01", "2025-06-30"].

Anything unusable must give null, never an error: a missing part, text that is not a date, a date that does not exist (2025-02-30), or an empty range. A reversed range is swapped.

What Check tests

  1. A good range comes back as two dates
  2. A reversed range is swapped
  3. Missing or unreadable parts give null
  4. A date that does not exist gives null
  5. An empty range gives null

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.