/soonerorlater

JavaScript parser of natural language time periods

Primary LanguageTypeScriptMIT LicenseMIT

💬 📅 Sooner or Later

Parse natural language dates

minified and gzipped size minified size zero dependencies

Install

npm add soonerorlater

Examples

import { parse } from "soonerorlater";

parse('Every Wednesday');
/*
{
  repeats: 'weekly',
  weekdays: new Set(['wednesday'])
}
*/

parse('Mondays and Thursdays at 9:30am to 10:30am');
/*
{
  repeats: 'weekly',
  weekdays: new Set(['monday', 'thursday']),
  startTime: { hours: 9, minutes: 30 },
  endTime: { hours: 10, minutes: 30 }
}
*/

Notes

  • Uses the library parcook for parsing.
  • TODO: support standard representations as result