Natural language processing for date chooser

Our date picker and conversion is a powerful feature. I’d love to see us make it simpler to add a date/time to a post. A common way this is done is through natural language processing. Apps like Fantastical on iOS have used this for years for date input.

Instead of fiddling with the mouse to input a date, you could type in something like:

  • monday at 2pm which would output the date and time to your timezone
  • next friday at 10am NZST which outputs the date/time next friday in NZST
  • 11am which outputs today’s date at 11am
  • 8/9 to 8/13 which outputs a date range.

This could either replace the modal shown by clicking the calendar icon in the composer with a textbox (and an advanced button which shows the existing modal contents) or a separate modal launched by a keyboard shortcut.


This library might help with implementation: GitHub - wanasit/chrono: A natural language date parser in Javascript

That said I suspect it would be a challenge to get robust language support for this.

The current fully supported languages are en , ja , and fr ( de and pt are partially supported). Other languages from v1 ( nl and zh ) are under development.

Also, another UX pattern to consider is automatically replacing date strings in the body of a post with Discourse date/time objects. Sort of like one-boxing but for dates. E.g. if I type “next monday at 2pm” in my post, it automatically converts that to 2021-08-17T18:00:00Z.


I really like this idea!