
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A lightweight JavaScript date library for parsing and formatting natural language relative dates.
An small example set of strings that can be parsed:
two seconds
1 second
every 4 days
every other day
1 hour from now
after 2 hours
once per hour
every 48 hours
Install with npm:
npm install dateparser --save
You can use Bower to install.
bower install dateparser
bower install jhaynie/dateparser
If you don't use Bower as a package manager, you can copy the minified JS from dateparser.min.js to the location of your web assets directory and inclue it in your HTML manually.
The API has only 2 methods parse and format.
To parse a date, call parse with a string of text. The result is an object with two properties: value (Number) and relative (Boolean). The value property is the milliseconds value. The relative property indicates if the value is a relative date or a recurring date.
var result = dateparser.parse('every 1 hour');
console.log('%d', result.value);
If the results relative property is true, the value will be a date in milliseconds format from Date.now(). If the reuslts relative property is false, the value will be the absolute milliseconds value of the parsed string (for example, 1 seconds will be returned as 1000).
Format a result object returned from parse in a human readable format.
var result = dateparser.parse('every 1 hour');
console.log(dateparser.format(result));
Copyright (c) 2015 by Jeff Haynie. Licensed under the Apache-2.0 license.
FAQs
A human language relative date parser
We found that dateparser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.