moment-parseplus
Advanced tools
Comparing version 1.0.3 to 1.1.0
## Change Log | ||
### v1.1.0 on 2017-12-02 | ||
- Added first day / last day parser (thanks to @Claymm for PR) | ||
- Updated dependencies and tested working with moment 2.19 | ||
### v1.0.3 on 2017-08-02 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "moment-parseplus", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Date parsing plugin for momentjs", | ||
@@ -14,3 +14,4 @@ "main": "parseplus.js", | ||
"coverage": "node ./node_modules/istanbul/lib/cli.js cover node_modules/.bin/_mocha -- -- test/**/*.spec.js", | ||
"view-coverage": "open ./coverage/lcov-report/index.html" | ||
"view-coverage": "open ./coverage/lcov-report/index.html", | ||
"clean-install": "rm -Rf node_modules && npm install" | ||
}, | ||
@@ -39,7 +40,7 @@ "repository": { | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"chai": "^4.1.2", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^2.5.3", | ||
"requirejs": "^2.3.4" | ||
"requirejs": "^2.3.5" | ||
} | ||
} |
@@ -404,2 +404,22 @@ (function (root, factory) { | ||
}) | ||
.addParser({ | ||
name: 'firstlastdayof', | ||
matcher: /^(first|last) day of (last|this|the|next) (week|month|year)/i, | ||
handler: function(match) { | ||
var firstlast = match[1].toLowerCase(); | ||
var lastnext = match[2].toLowerCase(); | ||
var monthyear = match[3].toLowerCase(); | ||
var date = moment(); | ||
if (lastnext == 'last') { | ||
date.subtract(1, monthyear); | ||
} | ||
else if (lastnext == 'next') { | ||
date.add(1, monthyear); | ||
} | ||
if (firstlast == 'first') { | ||
return date.startOf(monthyear); | ||
} | ||
return date.endOf(monthyear); | ||
} | ||
}) | ||
; | ||
@@ -406,0 +426,0 @@ |
# moment-parseplus | ||
[![Build Status](https://travis-ci.org/kensnyder/moment-parseplus.svg?branch=master&v=1.0.3)](https://travis-ci.org/kensnyder/moment-parseplus) | ||
[![Code Coverage](https://codecov.io/gh/kensnyder/moment-parseplus/branch/master/graph/badge.svg?v=1.0.3)](https://codecov.io/gh/kensnyder/moment-parseplus) | ||
[![MIT License](https://img.shields.io/npm/l/express.svg?v=1.0.3)](https://opensource.org/licenses/MIT) | ||
[![Build Status](https://travis-ci.org/kensnyder/moment-parseplus.svg?branch=master&v=1.1.0)](https://travis-ci.org/kensnyder/moment-parseplus) | ||
[![Code Coverage](https://codecov.io/gh/kensnyder/moment-parseplus/branch/master/graph/badge.svg?v=1.1.0)](https://codecov.io/gh/kensnyder/moment-parseplus) | ||
[![MIT License](https://img.shields.io/npm/l/express.svg?v=1.1.0)](https://opensource.org/licenses/MIT) | ||
@@ -97,2 +97,4 @@ An extensible date parsing plugin for [momentjs](http://momentjs.com) | ||
- in 6 hours | ||
- first day of last month | ||
- last day of next month | ||
- etc. | ||
@@ -99,0 +101,0 @@ |
Sorry, the diff of this file is not supported yet
51799
1111
252