moment-recur
Advanced tools
Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "moment-recur", | ||
"main": "moment-recur.js", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"homepage": "https://github.com/c-trimm/moment-recur", | ||
@@ -6,0 +6,0 @@ "authors": [ |
@@ -0,0 +0,0 @@ var gulp = require('gulp'); |
@@ -0,0 +0,0 @@ // Karma configuration |
@@ -714,20 +714,3 @@ (function (root, factory) { | ||
moment.fn.monthWeekByDay = function(date) { | ||
var day, week0, day0, diff; | ||
// date obj | ||
day = this.clone(); | ||
// First day of the first week of the month | ||
week0 = this.clone().startOf("month").startOf("week"); | ||
// First day of week | ||
day0 = this.clone().startOf("week"); | ||
diff = day0.diff(week0, "weeks"); | ||
if (day.subtract(diff, "weeks").month() === this.clone().month()) { | ||
return diff; | ||
} | ||
return diff - 1; | ||
return Math.floor((this.date()-1)/7); | ||
}; | ||
@@ -734,0 +717,0 @@ |
{ | ||
"name": "moment-recur", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A momentjs plugin for matching and generating recurring dates.", | ||
@@ -17,2 +17,5 @@ "main": "moment-recur.js", | ||
"license": "Unlicense", | ||
"dependencies": { | ||
"moment": "<3.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -28,6 +31,4 @@ "gulp": "~3.8.10", | ||
"scripts": { | ||
"test": "gulp test", | ||
"preinstall": "npm install bower gulp", | ||
"postinstall": "bower install" | ||
"test": "gulp test" | ||
} | ||
} |
@@ -214,4 +214,9 @@ moment-recur | ||
// The following matches every 1st and 3rd Thursday of the month. | ||
// (Note this cannot be combined at the moment with every(x).months() expression) | ||
cal = moment.recur().every("Thursday").daysOfWeek() | ||
.every([0, 2]).weeksOfMonthByDay(); | ||
cal = moment.recur().every(moment("01/01/2014").day()).daysOfWeek() | ||
.every(moment("01/01/2014").monthWeekByDay()).weeksOfMonthByDay(); | ||
``` | ||
@@ -218,0 +223,0 @@ |
@@ -287,2 +287,15 @@ 'use strict'; | ||
it("can recur on the 4th Wednesday of the month", function() { | ||
var recurrence; | ||
recurrence = moment.recur() | ||
.every(moment('2017-09-27').day()).daysOfWeek() | ||
.every(moment('2017-09-27').monthWeekByDay()).weeksOfMonthByDay(); | ||
expect(recurrence.matches(moment('2017-09-27'))).toBe(true); | ||
expect(recurrence.matches(moment('2017-10-25'))).toBe(true); | ||
expect(recurrence.matches(moment('2017-11-22'))).toBe(true); | ||
expect(recurrence.matches(moment('2017-12-27'))).toBe(true); | ||
}); | ||
it("will throw an error if used without daysOfWeek()", function() { | ||
@@ -289,0 +302,0 @@ var recurrence, caught = { message: false }; |
Sorry, the diff of this file is not supported yet
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
376
0
0
59801
1
9
1075
+ Addedmoment@<3.0.0
+ Addedmoment@2.30.1(transitive)