Parse natural language sentences to dates equivalent.
npm install dateparser-nlpnpm install --save dateparser-nlp const dateparser = require('dateparser-nlp')
dateparser.config( {apiKey: 'putyourAPIkeyhere'} )
`
#### Date format system
If you are using U.S dating system (MM/DD/YYYY), use this command to set the date format correctly:
`
dateparser.config( {dateFormat: 'mdy'} )
`
If you are using International Date System (DD/MM/YYYY), you can use a similar setup:
`
dateparser.config( {dateFormat: 'dmy'} )
`
*Note: this is the default configuration, therefore this line is optional if you are not switching between formats.
$3
---
#### basic usage
`
dateparser.parse('I went shopping on the 24th Dec. 2017.', function(error, dates){
/ do what you want here /
}
`
#### bulk usage
This method does the same as the previous one, but on an array of sentences, giving back the results as an array of dates.
`
dateparser.parseBulk(
['I went shopping on the 24th Dec. 2017.','I loved the movie we saw yesterday'],
function(error, datesArray){
/*
do what you want here
datesArray[0] is result(s) for the first sentence
datesArray[1] is result(s) for the second sentence
...
*/
}
``