Skip to content

associatedemployers/string-ranger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Ranger Build Status

An easy to use, case-insensitive string to date range converter.

Why

String ranger was made as a result of a need to parse incoming user strings to system date ranges.

How

Install

$ npm install string-ranger

Use

var stringRange = require('string-ranger');

var todayInARange = stringRange('today');
// { start: { Date for start of today }, end: { Date for end of today } }
var thisMonth = stringRange('this Month');
var last3Days = stringRange('last 3 days');
var lastYear = stringRange('Last year');

Supported Range Types

  • Singular
    • "today"
  • Unit
    • "second"
    • "day"
    • "week"
    • "month"
    • "year"

String format

You can use the singular ("today") range type, or you can use the format below.

[verb last|this] [units (optional, ex. 30)] [unit (ex. day)]

Examples

Last                                        Year
Last             6                          Days
This                                        Month

About

Neat utility that converts strings to date ranges.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published