Socket
Socket
Sign inDemoInstall

ambit

Package Overview
Dependencies
2
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ambit

Date parser that returns a range instead of a single value


Version published
Weekly downloads
3
decreased by-62.5%
Maintainers
1
Install size
4.04 MB
Created
Weekly downloads
 

Readme

Source

#ambit

So it turns out I couldn't find anything out there that parsed a date string and returned a date range. Typically if you ask for "March" you get "March 1" instead of "March 1 through March 31"

This is an attempt at doing the latter.

Requires moment.

Season calculations done via moonbeams

Right now it only does day-level granularity.

If a year is not given, ambit will make every effort to assume the dates should be in the future

#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

FAQs

Last updated on 08 Aug 2014

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