1.1.1 • Published 3 years ago

conversational-date-parser v1.1.1

Weekly downloads
7
License
ISC
Repository
github
Last release
3 years ago

CDP

Conversational date parser

Performs context aware parsing of strings like 'year to date' or 'Q3 2020' or 'march-april'.

Installation

npm install --save conversational-date-parser
npm run test

Usage

const Cdp=require("conversational-date-parser");

let cdp=new CDP();
let result=cdp.parse("March through April 2015"); // [{"year":2015,"month":3,"day":1},{"year":2015,"month":4, "day":30}]

Notes

CDP.parse() returns an array that is either empty, or contains two elements representing the range inferred by the text input. Input like "today" will result in a one-day date range; calling .toDate() on each result item will result in a Date() object that represents the first millisecond and the last millisecond of that day, respectively.

Todo

  • Remove dependency on moment.js
  • Finish documenting index.js
  • Add build task for compiling documentation
  • Clean up one of the tests that is not a unit test
  • Add more cases ("thursday through friday", etc)
1.1.1

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago