Adam Stacoviak changelog.com/posts

Write a Date() like a human

As a person who is constantly thinking about the user’s experience when interacting with my software, writing the date and time using real english such as “2 days from today”, or “tomorrow at 5pm” provides the, often needed, human touch I’m looking for.

Date, from Matthew Mueller, is an english language date parser for node.js and the browser that lets your users write dates like a normal human being using real english.

A few examples from the readme:

date('10 minutes from now')
date('in 5 hours')
date('at 5pm')
date('at 12:30')
date('at 23:35')
date('in 2 days')
date('tuesday at 9am')
date('monday at 1:00am')
date('last monday at 1:00am')
date('tomorrow at 3pm')
date('yesterday at 12:30am')
date('5pm tonight')
date('tomorrow at noon')

Check out the source on GitHub or the homepage for examples and demos.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00