You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ambit

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ambit

Date parser that returns a range instead of a single value

0.1.3
Source
npmnpm
Version published
Weekly downloads
3
-88.89%
Maintainers
1
Weekly downloads
 
Created
Source

#ambit

So it turns out I couldn't find anything out there that parsed a date string in nominally plain English and returned a date range. This is a WIP attempt at doing so. Requires moment.

#use

var ambit = require('ambit'); //ambit is moment + ambit now;                
var range = ambit.ambit('Spring 2005');

range will now either be undefined (unparseable input) or an object w/ a start and end attribute, which will be moment objects representing the start and end range of the input.

##formatting

var ambit = require('ambit');
var range = ambit.ambit('Sept 2020', 'YYYY-MM-DD');

the start and end attributes will now be strings formatted YYYY-MM-DD

That's about it for now, it's pretty basic, probably has lots of edge-case bugs, and needs more tests.

License: MIT

Keywords

date

FAQs

Package last updated on 06 Aug 2014

Did you know?

Socket

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