Experiments >

Readable date ranges

Experiment #21720th July, 2021by Joshua Nussbaum

I want to create a date range picker component for the charts I was building, but I want it to be able to display the range as human readable text when possible.

It should display text like:

  • today
  • yesterday
  • last n days
  • last n weeks
  • Jan 1st - Jan 5th

So I built a function that takes two dates, from and to, and formats them accordingly.





view all experiments

Stay tuned in

Learn how to add more experimentation to your workflow