Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a natural language parser for date/times in javascript?

Is there a natural language parser for date/times in javascript?

like image 663
antony.trupe Avatar asked Jun 16 '09 18:06

antony.trupe


People also ask

What is date parse in JavaScript?

The Date. parse() method parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or NaN if the string is unrecognized or, in some cases, contains illegal date values (e.g. 2015-02-31). Only the ISO 8601 format ( YYYY-MM-DDTHH:mm:ss.

Is date in JS a string?

JavaScript Date toString()The toString() method returns a date object as a string.

What is date in node JS?

In Node. js date and time are handled with the Javascript Date object. It is loaded by default and requires no import of modules.


2 Answers

I made Chrono a small library for parsing dates in JavaScript. I added a date range parsing feature (such as '12 Nov - 13 Dec 2012') .

like image 70
Wanasit Tanakitrungruang Avatar answered Sep 17 '22 13:09

Wanasit Tanakitrungruang


SugarJS supports some natural language parsing of dates and times.

You can jump to the live example here: http://sugarjs.com/dates

For example, it supports the following inputs:

  • the day after tomorrow
  • 2 weeks from monday
  • May 25th of next year

You can then covert the result into different date formats or use the API to further manipulate the date.

like image 28
Bradley Dwyer Avatar answered Sep 17 '22 13:09

Bradley Dwyer