Socket
Socket
Sign inDemoInstall

dateparser-nlp

Package Overview
Dependencies
47
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dateparser-nlp

Parse natural language sentences to dates equivalent.


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Install size
3.72 MB
Created
Weekly downloads
 

Readme

Source

Date Parser

Official website: https://dateparser.io Official documentation: https://dateparser.io/documentation

Install


npm
Run:
npm install --save dateparser-nlp
Initialize with:
const dateparser = require('dateparser-nlp')

Configuration


In order to work, you need to have an API key to use Date Parser. API keys can be obtained for free at https://dateparser.io. It is fast and simple. Once you have an API key, just run this to add the key to configuration:

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.

Usage


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
	... 
	*/
}

FAQs

Last updated on 09 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc