Socket
Socket
Sign inDemoInstall

@livelybone/date-generator

Package Overview
Dependencies
0
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.4 to 4.1.5

60

lib/es/index.js
/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -287,54 +287,58 @@ * Author: 2631541504@qq.com

}
function calcStepBetweenDates(date1, date2) {
var $date1 = typeof date1 === 'string' ? parseDate(date1) : date1;
var $date2 = typeof date2 === 'string' ? parseDate(date2) : date2;
if (!$date1 || !$date2) return 0;
var sorted = [$date1, $date2].sort(compareDates);
var yearStep = +sorted[1].year - +sorted[0].year;
function calcStepBetweenDates(date, targetDate) {
var $date = typeof date === 'string' ? parseDate(date) : date;
var $targetDate = typeof targetDate === 'string' ? parseDate(targetDate) : targetDate;
if (!$date || !$targetDate) return 0;
var compare = compareDates($date, $targetDate);
if (compare === 0) return 0;
var small = compare > 0 ? $targetDate : $date;
var big = compare > 0 ? $date : $targetDate;
var flag = compare > 0 ? 1 : -1;
var yearStep = +big.year - +small.year;
if (yearStep > 1) {
return new Array(yearStep).join(',').split(',').reduce(function (pre, v, i) {
var year = +sorted[0].year + i + 1;
return (new Array(yearStep).join(',').split('').reduce(function (pre, v, i) {
var year = +small.year + i + 1;
return pre + (isLeapYear(year) ? 366 : 365);
}, 0) + calcStepBetweenDates(sorted[0], _objectSpread2({}, sorted[0], {
}, 0) + calcStepBetweenDates(_objectSpread2({}, small, {
month: 12,
date: 31
})) + calcStepBetweenDates(_objectSpread2({}, sorted[1], {
}), small) + calcStepBetweenDates(big, _objectSpread2({}, big, {
month: 1,
date: 1
}), sorted[1]);
})) + 1) * flag;
}
if (yearStep === 1) {
return calcStepBetweenDates(sorted[0], _objectSpread2({}, sorted[0], {
return (calcStepBetweenDates(_objectSpread2({}, small, {
month: 12,
date: 31
})) + calcStepBetweenDates(_objectSpread2({}, sorted[1], {
}), small) + calcStepBetweenDates(big, _objectSpread2({}, big, {
month: 1,
date: 1
}), sorted[1]);
})) + 1) * flag;
}
var monthStep = +sorted[1].month - +sorted[0].month;
var monthStep = +big.month - +small.month;
if (monthStep > 1) {
return new Array(monthStep).join(',').split(',').reduce(function (pre, v, i) {
var month = +sorted[0].month + i + 1;
return pre + getMonthLen(sorted[0].year, month);
}, 0) + calcStepBetweenDates(sorted[0], _objectSpread2({}, sorted[0], {
date: 31
})) + calcStepBetweenDates(_objectSpread2({}, sorted[1], {
return (new Array(monthStep).join(',').split('').reduce(function (pre, v, i) {
var month = +small.month + i + 1;
return pre + getMonthLen(small.year, month);
}, 0) + calcStepBetweenDates(_objectSpread2({}, small, {
date: getMonthLen(small.year, small.month)
}), small) + calcStepBetweenDates(big, _objectSpread2({}, big, {
date: 1
}), sorted[1]);
})) + 1) * flag;
}
if (monthStep === 1) {
return calcStepBetweenDates(sorted[0], _objectSpread2({}, sorted[0], {
date: 31
})) + calcStepBetweenDates(_objectSpread2({}, sorted[1], {
return (calcStepBetweenDates(_objectSpread2({}, small, {
date: getMonthLen(small.year, small.month)
}), small) + calcStepBetweenDates(big, _objectSpread2({}, big, {
date: 1
}), sorted[1]);
})) + 1) * flag;
}
return +sorted[1].month - +sorted[0].month;
return (+big.date - +small.date) * flag;
}

@@ -341,0 +345,0 @@ function gntCalendar(monthInfo, options) {

/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -6,0 +6,0 @@ * Author: 2631541504@qq.com

/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -9,2 +9,2 @@ * Author: 2631541504@qq.com

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).dateDateGenerator={})}(this,function(e){"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function h(a){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(Object(o),!0).forEach(function(e){var t,r,n;t=a,n=o[r=e],r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(o,e))})}return a}function x(e,t,r){var n=2<arguments.length&&void 0!==r?r:"0";return void 0===n&&(n="0"),0<(e-=(t=t.toString()).length)?new Array(e+(/\./.test(t)?2:1)).join(n)+t:t}function E(e){return(e=+e)===Math.floor(e)&&0<=e}function S(e,t){return(e%t+t)%t}function u(e){return(e=+e)%4==0&&(e%100!=0||e%400==0)}function Y(e,t){return e=+e,2===(t=+t)?u(e)?29:28:Math.ceil(Math.abs(t-7.5))%2==1?31:30}function N(e){if(!e)return null;var t=/^(\d{4})-?(\d{1,2})?-?(\d{1,2})?$/;if(!t.test(e))return console.error("Utils.parseDate: Param date is invalid. The right example: 2018[-02][-01]"),null;var r=e.match(t),n={year:x(4,r[1]),month:x(2,S(+r[2]||1,13))},a=Y(n.year,n.month);return n.date=x(2,S(+r[3]||1,a)||a),n}function B(e,t){var r="string"==typeof e?N(e):e;if(!r)return null;var n=+r.month+t,a=S(n,12),o=Math.floor(n/12);return 0===a&&--o,{year:x(4,+r.year+o),month:x(2,a||12)}}var r,n,o,a;function s(e,t){var r="string"==typeof e?N(e):e,n="string"==typeof t?N(t):t;if(!r||!n)return o.Equal;var a=r.year-n.year;return a?0<a?o.GreatThanYear:o.LessThanYear:(a=r.month-n.month)?0<a?o.GreatThanMonth:o.LessThanMonth:(a=r.date-n.date)?0<a?o.GreatThanDate:o.LessThanDate:o.Equal}function q(e,t){var r="string"==typeof e?N(e):e,n="string"==typeof t?N(t):t;if(!r||!n)return 0;var a=[r,n].sort(s),o=a[1].year-a[0].year;if(1<o)return new Array(o).join(",").split(",").reduce(function(e,t,r){return e+(u(+a[0].year+r+1)?366:365)},0)+q(a[0],h({},a[0],{month:12,date:31}))+q(h({},a[1],{month:1,date:1}),a[1]);if(1==o)return q(a[0],h({},a[0],{month:12,date:31}))+q(h({},a[1],{month:1,date:1}),a[1]);var i=a[1].month-a[0].month;return 1<i?new Array(i).join(",").split(",").reduce(function(e,t,r){var n=+a[0].month+r+1;return e+Y(a[0].year,n)},0)+q(a[0],h({},a[0],{date:31}))+q(h({},a[1],{date:1}),a[1]):1==i?q(a[0],h({},a[0],{date:31}))+q(h({},a[1],{date:1}),a[1]):a[1].month-a[0].month}(n=r=r||{})[n.Hour=23]="Hour",n[n.Minute=59]="Minute",n[n.Second=59]="Second",(a=o=o||{})[a.GreatThanYear=100]="GreatThanYear",a[a.GreatThanMonth=10]="GreatThanMonth",a[a.GreatThanDate=1]="GreatThanDate",a[a.Equal=0]="Equal",a[a.LessThanDate=-1]="LessThanDate",a[a.LessThanMonth=-10]="LessThanMonth",a[a.LessThanYear=-100]="LessThanYear",e.calcStepBetweenDates=q,e.compareDates=s,e.getDateByStep=function e(t,r){var n="string"==typeof t?N(t):t;if(!n)return null;var a=Y(n.year,n.month),o=+n.date+r;if(o<=0){var i=B(n,-1);return e(h({},i,{date:Y(i.year,i.month)}),o)}return a<o?e(h({},B(n,1),{date:1}),o-a):{year:x(4,n.year),month:x(2,n.month),date:x(2,o)}},e.gntCalendar=function(e,t){var r="string"==typeof e?N(e):e;if(!r)return null;var n=+r.year,a=+r.month;if(t=t||{},!E(n)||!E(a))throw new Error("Prop year and month must be a non-negative number");for(var o,i,h,u,s,f,c,y="string"==typeof t.min?N(t.min):t.min,l="string"==typeof t.max?N(t.max):t.max,m=B({year:n,month:a},-1),d=Y(m.year,m.month),p=Y(n,a),v=B({year:n,month:a},1),g=Math.ceil(31/7)+1,b=[],M=function(o,i,h){function e(e,t){if(!e)return!0;t=t||1;var r=+e.year,n=+e.month,a=+e.date;return 0<(o-r)*t||o===r&&0<(i-n)*t||o===r&&i===n&&0<=(h-a)*t}return e(y)&&e(l,-1)},T=1,w=1,O=(o=+(o=n),h=+(h=1),f=1==(i=+(i=a))||2===i?(u=Math.floor((o-1)/100),s=(o-1)%100,i+12):(u=Math.floor(o/100),s=o%100,i),S(s+Math.floor(s/4)+Math.floor(u/4)-2*u+Math.floor(26*(f+1)/10)+h-1,7)),j=0===O?7:O,D={year:x(4,(c=new Date).getFullYear()),month:x(2,c.getMonth()+1),date:x(2,c.getDate())},P=0;P<g;P+=1){b[P]=[];for(var G=0;G<7;G+=1)if(0===P&&G<j){var L=d-j+1+G;b[P][G]={year:x(4,m.year),month:x(2,m.month),date:x(2,L),isInThisMonth:!1,canBeChose:M(+m.year,+m.month,L),isNow:!1},b[P][G].isNow=0===q(D,b[P][G])}else T<=p?(b[P][G]={year:x(4,n),month:x(2,a),date:x(2,T),isInThisMonth:!0,canBeChose:M(n,a,T),isNow:!1},b[P][G].isNow=0===q(D,b[P][G]),T+=1):(b[P][G]={year:x(4,v.year),month:x(2,v.month),date:x(2,w),isInThisMonth:!1,canBeChose:M(+v.year,+v.month,w),isNow:!1},b[P][G].isNow=0===q(D,b[P][G]),w+=1)}return b},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).dateDateGenerator={})}(this,function(e){"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function f(a){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?t(Object(o),!0).forEach(function(e){var t,r,n;t=a,n=o[r=e],r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(o,e))})}return a}function x(e,t,r){var n=2<arguments.length&&void 0!==r?r:"0";return void 0===n&&(n="0"),0<(e-=(t=t.toString()).length)?new Array(e+(/\./.test(t)?2:1)).join(n)+t:t}function E(e){return(e=+e)===Math.floor(e)&&0<=e}function S(e,t){return(e%t+t)%t}function c(e){return(e=+e)%4==0&&(e%100!=0||e%400==0)}function Y(e,t){return e=+e,2===(t=+t)?c(e)?29:28:Math.ceil(Math.abs(t-7.5))%2==1?31:30}function N(e){if(!e)return null;var t=/^(\d{4})-?(\d{1,2})?-?(\d{1,2})?$/;if(!t.test(e))return console.error("Utils.parseDate: Param date is invalid. The right example: 2018[-02][-01]"),null;var r=e.match(t),n={year:x(4,r[1]),month:x(2,S(+r[2]||1,13))},a=Y(n.year,n.month);return n.date=x(2,S(+r[3]||1,a)||a),n}function B(e,t){var r="string"==typeof e?N(e):e;if(!r)return null;var n=+r.month+t,a=S(n,12),o=Math.floor(n/12);return 0===a&&--o,{year:x(4,+r.year+o),month:x(2,a||12)}}var r,n,o,a;function y(e,t){var r="string"==typeof e?N(e):e,n="string"==typeof t?N(t):t;if(!r||!n)return o.Equal;var a=r.year-n.year;return a?0<a?o.GreatThanYear:o.LessThanYear:(a=r.month-n.month)?0<a?o.GreatThanMonth:o.LessThanMonth:(a=r.date-n.date)?0<a?o.GreatThanDate:o.LessThanDate:o.Equal}function q(e,t){var r="string"==typeof e?N(e):e,n="string"==typeof t?N(t):t;if(!r||!n)return 0;var a=y(r,n);if(0===a)return 0;var o=0<a?n:r,i=0<a?r:n,h=0<a?1:-1,u=i.year-o.year;if(1<u)return(new Array(u).join(",").split("").reduce(function(e,t,r){return e+(c(+o.year+r+1)?366:365)},0)+q(f({},o,{month:12,date:31}),o)+q(i,f({},i,{month:1,date:1}))+1)*h;if(1==u)return(q(f({},o,{month:12,date:31}),o)+q(i,f({},i,{month:1,date:1}))+1)*h;var s=i.month-o.month;return 1<s?(new Array(s).join(",").split("").reduce(function(e,t,r){var n=+o.month+r+1;return e+Y(o.year,n)},0)+q(f({},o,{date:Y(o.year,o.month)}),o)+q(i,f({},i,{date:1}))+1)*h:1==s?(q(f({},o,{date:Y(o.year,o.month)}),o)+q(i,f({},i,{date:1}))+1)*h:(i.date-o.date)*h}(n=r=r||{})[n.Hour=23]="Hour",n[n.Minute=59]="Minute",n[n.Second=59]="Second",(a=o=o||{})[a.GreatThanYear=100]="GreatThanYear",a[a.GreatThanMonth=10]="GreatThanMonth",a[a.GreatThanDate=1]="GreatThanDate",a[a.Equal=0]="Equal",a[a.LessThanDate=-1]="LessThanDate",a[a.LessThanMonth=-10]="LessThanMonth",a[a.LessThanYear=-100]="LessThanYear",e.calcStepBetweenDates=q,e.compareDates=y,e.getDateByStep=function e(t,r){var n="string"==typeof t?N(t):t;if(!n)return null;var a=Y(n.year,n.month),o=+n.date+r;if(o<=0){var i=B(n,-1);return e(f({},i,{date:Y(i.year,i.month)}),o)}return a<o?e(f({},B(n,1),{date:1}),o-a):{year:x(4,n.year),month:x(2,n.month),date:x(2,o)}},e.gntCalendar=function(e,t){var r="string"==typeof e?N(e):e;if(!r)return null;var n=+r.year,a=+r.month;if(t=t||{},!E(n)||!E(a))throw new Error("Prop year and month must be a non-negative number");for(var o,i,h,u,s,f,c,y="string"==typeof t.min?N(t.min):t.min,l="string"==typeof t.max?N(t.max):t.max,m=B({year:n,month:a},-1),d=Y(m.year,m.month),p=Y(n,a),v=B({year:n,month:a},1),g=Math.ceil(31/7)+1,b=[],M=function(o,i,h){function e(e,t){if(!e)return!0;t=t||1;var r=+e.year,n=+e.month,a=+e.date;return 0<(o-r)*t||o===r&&0<(i-n)*t||o===r&&i===n&&0<=(h-a)*t}return e(y)&&e(l,-1)},T=1,w=1,O=(o=+(o=n),h=+(h=1),f=1==(i=+(i=a))||2===i?(u=Math.floor((o-1)/100),s=(o-1)%100,i+12):(u=Math.floor(o/100),s=o%100,i),S(s+Math.floor(s/4)+Math.floor(u/4)-2*u+Math.floor(26*(f+1)/10)+h-1,7)),j=0===O?7:O,D={year:x(4,(c=new Date).getFullYear()),month:x(2,c.getMonth()+1),date:x(2,c.getDate())},P=0;P<g;P+=1){b[P]=[];for(var G=0;G<7;G+=1)if(0===P&&G<j){var L=d-j+1+G;b[P][G]={year:x(4,m.year),month:x(2,m.month),date:x(2,L),isInThisMonth:!1,canBeChose:M(+m.year,+m.month,L),isNow:!1},b[P][G].isNow=0===q(D,b[P][G])}else T<=p?(b[P][G]={year:x(4,n),month:x(2,a),date:x(2,T),isInThisMonth:!0,canBeChose:M(n,a,T),isNow:!1},b[P][G].isNow=0===q(D,b[P][G]),T+=1):(b[P][G]={year:x(4,v.year),month:x(2,v.month),date:x(2,w),isInThisMonth:!1,canBeChose:M(+v.year,+v.month,w),isNow:!1},b[P][G].isNow=0===q(D,b[P][G]),w+=1)}return b},Object.defineProperty(e,"__esModule",{value:!0})});
/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -9,2 +9,2 @@ * Author: 2631541504@qq.com

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).DateGenerator={})}(this,function(o){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function u(a){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?r(Object(o),!0).forEach(function(e){var t,r,n;t=a,n=o[r=e],r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(o,e))})}return a}function w(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"0";return void 0===r&&(r="0"),0<(e-=(t=t.toString()).length)?new Array(e+(/\./.test(t)?2:1)).join(r)+t:t}function T(e){return(e=+e)===Math.floor(e)&&0<=e}function i(e,t){return(e%t+t)%t}function h(e){return(e=+e)%4==0&&(e%100!=0||e%400==0)}function j(e,t){return e=+e,2===(t=+t)?h(e)?29:28:Math.ceil(Math.abs(t-7.5))%2==1?31:30}function e(i){return function(e){for(var t=Math.ceil(Math.abs(e&&e.interval||1)),r=Math.ceil(Math.abs(e&&e.min||0)),n=Math.ceil(Math.abs(e&&e.max||i-1)),a=[],o=0;o<i;o+=t)a.push({value:w(2,o),max:i,canBeChose:r<=o&&o<=n});return a}}function O(e){if(!e)return null;var t=/^(\d{4})-?(\d{1,2})?-?(\d{1,2})?$/;if(!t.test(e))return console.error("Utils.parseDate: Param date is invalid. The right example: 2018[-02][-01]"),null;var r=e.match(t),n={year:w(4,r[1]),month:w(2,i(+r[2]||1,13))},a=j(n.year,n.month);return n.date=w(2,i(+r[3]||1,a)||a),n}function x(){var e=new Date;return{year:w(4,e.getFullYear()),month:w(2,e.getMonth()+1),date:w(2,e.getDate())}}function C(e,t){var r="string"==typeof e?O(e):e;if(!r)return null;var n=+r.month+t,a=i(n,12),o=Math.floor(n/12);return 0===a&&--o,{year:w(4,+r.year+o),month:w(2,a||12)}}var n,a;function S(e,t,r){var n,a,o;return e=+e,r=+r,o=1===(t=+t)||2===t?(n=Math.floor((e-1)/100),a=(e-1)%100,t+12):(n=Math.floor(e/100),a=e%100,t),i(a+Math.floor(a/4)+Math.floor(n/4)-2*n+Math.floor(26*(o+1)/10)+r-1,7)}function s(e,t){var r="string"==typeof e?O(e):e,n="string"==typeof t?O(t):t;if(!r||!n)return o.DateCompare.Equal;var a=r.year-n.year;return a?0<a?o.DateCompare.GreatThanYear:o.DateCompare.LessThanYear:(a=r.month-n.month)?0<a?o.DateCompare.GreatThanMonth:o.DateCompare.LessThanMonth:(a=r.date-n.date)?0<a?o.DateCompare.GreatThanDate:o.DateCompare.LessThanDate:o.DateCompare.Equal}function P(e,t){var r="string"==typeof e?O(e):e,n="string"==typeof t?O(t):t;if(!r||!n)return 0;var a=[r,n].sort(s),o=a[1].year-a[0].year;if(1<o)return new Array(o).join(",").split(",").reduce(function(e,t,r){return e+(h(+a[0].year+r+1)?366:365)},0)+P(a[0],u({},a[0],{month:12,date:31}))+P(u({},a[1],{month:1,date:1}),a[1]);if(1==o)return P(a[0],u({},a[0],{month:12,date:31}))+P(u({},a[1],{month:1,date:1}),a[1]);var i=a[1].month-a[0].month;return 1<i?new Array(i).join(",").split(",").reduce(function(e,t,r){var n=+a[0].month+r+1;return e+j(a[0].year,n)},0)+P(a[0],u({},a[0],{date:31}))+P(u({},a[1],{date:1}),a[1]):1==i?P(a[0],u({},a[0],{date:31}))+P(u({},a[1],{date:1}),a[1]):a[1].month-a[0].month}(n=o.DefaultMax||(o.DefaultMax={}))[n.Hour=23]="Hour",n[n.Minute=59]="Minute",n[n.Second=59]="Second",(a=o.DateCompare||(o.DateCompare={}))[a.GreatThanYear=100]="GreatThanYear",a[a.GreatThanMonth=10]="GreatThanMonth",a[a.GreatThanDate=1]="GreatThanDate",a[a.Equal=0]="Equal",a[a.LessThanDate=-1]="LessThanDate",a[a.LessThanMonth=-10]="LessThanMonth",a[a.LessThanYear=-100]="LessThanYear";var f=e(o.DefaultMax.Hour),c=e(o.DefaultMax.Minute),m=e(o.DefaultMax.Second);o.calcStepBetweenDates=P,o.compareDates=s,o.fillTo=w,o.getDateByStep=function e(t,r){var n="string"==typeof t?O(t):t;if(!n)return null;var a=j(n.year,n.month),o=+n.date+r;if(o<=0){var i=C(n,-1);return e(u({},i,{date:j(i.year,i.month)}),o)}return a<o?e(u({},C(n,1),{date:1}),o-a):{year:w(4,n.year),month:w(2,n.month),date:w(2,o)}},o.getDay=S,o.getHour=f,o.getIntervalVal=e,o.getMinute=c,o.getMonthByStep=C,o.getMonthLen=j,o.getSecond=m,o.gntCalendar=function(e,t){var r="string"==typeof e?O(e):e;if(!r)return null;var n=+r.year,a=+r.month;if(t=t||{},!T(n)||!T(a))throw new Error("Prop year and month must be a non-negative number");for(var h="string"==typeof t.min?O(t.min):t.min,s="string"==typeof t.max?O(t.max):t.max,o=C({year:n,month:a},-1),i=j(o.year,o.month),u=j(n,a),f=C({year:n,month:a},1),c=Math.ceil(31/7)+1,m=[],l=function(o,i,u){function e(e,t){if(!e)return!0;t=t||1;var r=+e.year,n=+e.month,a=+e.date;return 0<(o-r)*t||o===r&&0<(i-n)*t||o===r&&i===n&&0<=(u-a)*t}return e(h)&&e(s,-1)},y=1,p=1,d=S(n,a,1),v=0===d?7:d,g=x(),M=0;M<c;M+=1){m[M]=[];for(var b=0;b<7;b+=1)if(0===M&&b<v){var D=i-v+1+b;m[M][b]={year:w(4,o.year),month:w(2,o.month),date:w(2,D),isInThisMonth:!1,canBeChose:l(+o.year,+o.month,D),isNow:!1},m[M][b].isNow=0===P(g,m[M][b])}else y<=u?(m[M][b]={year:w(4,n),month:w(2,a),date:w(2,y),isInThisMonth:!0,canBeChose:l(n,a,y),isNow:!1},m[M][b].isNow=0===P(g,m[M][b]),y+=1):(m[M][b]={year:w(4,f.year),month:w(2,f.month),date:w(2,p),isInThisMonth:!1,canBeChose:l(+f.year,+f.month,p),isNow:!1},m[M][b].isNow=0===P(g,m[M][b]),p+=1)}return m},o.gntMonth=function(e,t){e=+e;for(var r=(t=t||{}).splitLen||3,n="string"==typeof t.min?O(t.min):t.min,a="string"==typeof t.max?O(t.max):t.max,o=[],i=Math.ceil(12/r),u=x(),h=0;h<i;h+=1){o[h]=[];for(var s=0;s<r;s+=1){var f=h*r+s+1;if(12<f)break;o[h].push({year:w(4,e),month:w(2,f),canBeChose:!n&&!a||!!n&&!!a&&(e>+n.year||e===+n.year&&f>=+n.month)&&(e<+a.year||e===+a.year&&f<=+a.month)||!a&&!!n&&(e>+n.year||e===+n.year&&f>=+n.month)||!n&&!!a&&(e<+a.year||e===+a.year&&f<=+a.month),isNow:+u.year===e&&+u.month===f})}}return o},o.gntYear=function(e,t,r){if(r=r||{},!T(+(e=+e))||!T(+t))throw new Error("Prop start and len must be a non-negative number");for(var n=r.splitLen||3,a=r.min||null,o=r.max||null,i=[],u=Math.ceil(t/n),h=x(),s=0;s<u;s+=1){i[s]=[];for(var f=0;f<n;f+=1){var c=e+s*n+f;if(t<c-e+1)break;i[s].push({year:w(4,c),canBeChose:!a&&!o||!!a&&!!o&&a<=c&&c<=o||!a&&!!o&&c<=o||!o&&!!a&&a<=c,isNow:+h.year===c})}}return i},o.isLeapYear=h,o.isNonNegInt=T,o.nowDate=x,o.nowTime=function(){var e=new Date;return{hour:w(2,e.getHours()),minute:w(2,e.getMinutes()),second:w(2,e.getSeconds())}},o.objAssign=function(r,n){return r="object"===t(r)?r:{},n="object"===t(n)?n:{},Object.keys(r).concat(Object.keys(n)).reduce(function(e,t){return t in e||(e[t]=void 0!==n[t]?n[t]:r[t]),e},{})},o.parseDate=O,o.parseTime=function(e){if(!e)return null;var t=/^(\d{1,2}):?(\d{1,2})?:?(\d{1,2})?$/;if(!t.test(e))return console.error("Utils.parseDate: Param time is invalid. The right example: 18[:02][:01]"),null;var r=e.match(t);return{hour:w(2,i(+r[1],24)),minute:w(2,i(+r[2]||0,60)),second:w(2,i(+r[3]||0,60))}},o.positiveMod=i,Object.defineProperty(o,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).DateGenerator={})}(this,function(o){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function f(a){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?r(Object(o),!0).forEach(function(e){var t,r,n;t=a,n=o[r=e],r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(o,e))})}return a}function w(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"0";return void 0===r&&(r="0"),0<(e-=(t=t.toString()).length)?new Array(e+(/\./.test(t)?2:1)).join(r)+t:t}function T(e){return(e=+e)===Math.floor(e)&&0<=e}function i(e,t){return(e%t+t)%t}function c(e){return(e=+e)%4==0&&(e%100!=0||e%400==0)}function j(e,t){return e=+e,2===(t=+t)?c(e)?29:28:Math.ceil(Math.abs(t-7.5))%2==1?31:30}function e(i){return function(e){for(var t=Math.ceil(Math.abs(e&&e.interval||1)),r=Math.ceil(Math.abs(e&&e.min||0)),n=Math.ceil(Math.abs(e&&e.max||i-1)),a=[],o=0;o<i;o+=t)a.push({value:w(2,o),max:i,canBeChose:r<=o&&o<=n});return a}}function O(e){if(!e)return null;var t=/^(\d{4})-?(\d{1,2})?-?(\d{1,2})?$/;if(!t.test(e))return console.error("Utils.parseDate: Param date is invalid. The right example: 2018[-02][-01]"),null;var r=e.match(t),n={year:w(4,r[1]),month:w(2,i(+r[2]||1,13))},a=j(n.year,n.month);return n.date=w(2,i(+r[3]||1,a)||a),n}function x(){var e=new Date;return{year:w(4,e.getFullYear()),month:w(2,e.getMonth()+1),date:w(2,e.getDate())}}function C(e,t){var r="string"==typeof e?O(e):e;if(!r)return null;var n=+r.month+t,a=i(n,12),o=Math.floor(n/12);return 0===a&&--o,{year:w(4,+r.year+o),month:w(2,a||12)}}var n,a;function S(e,t,r){var n,a,o;return e=+e,r=+r,o=1===(t=+t)||2===t?(n=Math.floor((e-1)/100),a=(e-1)%100,t+12):(n=Math.floor(e/100),a=e%100,t),i(a+Math.floor(a/4)+Math.floor(n/4)-2*n+Math.floor(26*(o+1)/10)+r-1,7)}function m(e,t){var r="string"==typeof e?O(e):e,n="string"==typeof t?O(t):t;if(!r||!n)return o.DateCompare.Equal;var a=r.year-n.year;return a?0<a?o.DateCompare.GreatThanYear:o.DateCompare.LessThanYear:(a=r.month-n.month)?0<a?o.DateCompare.GreatThanMonth:o.DateCompare.LessThanMonth:(a=r.date-n.date)?0<a?o.DateCompare.GreatThanDate:o.DateCompare.LessThanDate:o.DateCompare.Equal}function P(e,t){var r="string"==typeof e?O(e):e,n="string"==typeof t?O(t):t;if(!r||!n)return 0;var a=m(r,n);if(0===a)return 0;var o=0<a?n:r,i=0<a?r:n,u=0<a?1:-1,h=i.year-o.year;if(1<h)return(new Array(h).join(",").split("").reduce(function(e,t,r){return e+(c(+o.year+r+1)?366:365)},0)+P(f({},o,{month:12,date:31}),o)+P(i,f({},i,{month:1,date:1}))+1)*u;if(1==h)return(P(f({},o,{month:12,date:31}),o)+P(i,f({},i,{month:1,date:1}))+1)*u;var s=i.month-o.month;return 1<s?(new Array(s).join(",").split("").reduce(function(e,t,r){var n=+o.month+r+1;return e+j(o.year,n)},0)+P(f({},o,{date:j(o.year,o.month)}),o)+P(i,f({},i,{date:1}))+1)*u:1==s?(P(f({},o,{date:j(o.year,o.month)}),o)+P(i,f({},i,{date:1}))+1)*u:(i.date-o.date)*u}(n=o.DefaultMax||(o.DefaultMax={}))[n.Hour=23]="Hour",n[n.Minute=59]="Minute",n[n.Second=59]="Second",(a=o.DateCompare||(o.DateCompare={}))[a.GreatThanYear=100]="GreatThanYear",a[a.GreatThanMonth=10]="GreatThanMonth",a[a.GreatThanDate=1]="GreatThanDate",a[a.Equal=0]="Equal",a[a.LessThanDate=-1]="LessThanDate",a[a.LessThanMonth=-10]="LessThanMonth",a[a.LessThanYear=-100]="LessThanYear";var u=e(o.DefaultMax.Hour),h=e(o.DefaultMax.Minute),s=e(o.DefaultMax.Second);o.calcStepBetweenDates=P,o.compareDates=m,o.fillTo=w,o.getDateByStep=function e(t,r){var n="string"==typeof t?O(t):t;if(!n)return null;var a=j(n.year,n.month),o=+n.date+r;if(o<=0){var i=C(n,-1);return e(f({},i,{date:j(i.year,i.month)}),o)}return a<o?e(f({},C(n,1),{date:1}),o-a):{year:w(4,n.year),month:w(2,n.month),date:w(2,o)}},o.getDay=S,o.getHour=u,o.getIntervalVal=e,o.getMinute=h,o.getMonthByStep=C,o.getMonthLen=j,o.getSecond=s,o.gntCalendar=function(e,t){var r="string"==typeof e?O(e):e;if(!r)return null;var n=+r.year,a=+r.month;if(t=t||{},!T(n)||!T(a))throw new Error("Prop year and month must be a non-negative number");for(var h="string"==typeof t.min?O(t.min):t.min,s="string"==typeof t.max?O(t.max):t.max,o=C({year:n,month:a},-1),i=j(o.year,o.month),u=j(n,a),f=C({year:n,month:a},1),c=Math.ceil(31/7)+1,m=[],l=function(o,i,u){function e(e,t){if(!e)return!0;t=t||1;var r=+e.year,n=+e.month,a=+e.date;return 0<(o-r)*t||o===r&&0<(i-n)*t||o===r&&i===n&&0<=(u-a)*t}return e(h)&&e(s,-1)},y=1,p=1,d=S(n,a,1),v=0===d?7:d,g=x(),M=0;M<c;M+=1){m[M]=[];for(var b=0;b<7;b+=1)if(0===M&&b<v){var D=i-v+1+b;m[M][b]={year:w(4,o.year),month:w(2,o.month),date:w(2,D),isInThisMonth:!1,canBeChose:l(+o.year,+o.month,D),isNow:!1},m[M][b].isNow=0===P(g,m[M][b])}else y<=u?(m[M][b]={year:w(4,n),month:w(2,a),date:w(2,y),isInThisMonth:!0,canBeChose:l(n,a,y),isNow:!1},m[M][b].isNow=0===P(g,m[M][b]),y+=1):(m[M][b]={year:w(4,f.year),month:w(2,f.month),date:w(2,p),isInThisMonth:!1,canBeChose:l(+f.year,+f.month,p),isNow:!1},m[M][b].isNow=0===P(g,m[M][b]),p+=1)}return m},o.gntMonth=function(e,t){e=+e;for(var r=(t=t||{}).splitLen||3,n="string"==typeof t.min?O(t.min):t.min,a="string"==typeof t.max?O(t.max):t.max,o=[],i=Math.ceil(12/r),u=x(),h=0;h<i;h+=1){o[h]=[];for(var s=0;s<r;s+=1){var f=h*r+s+1;if(12<f)break;o[h].push({year:w(4,e),month:w(2,f),canBeChose:!n&&!a||!!n&&!!a&&(e>+n.year||e===+n.year&&f>=+n.month)&&(e<+a.year||e===+a.year&&f<=+a.month)||!a&&!!n&&(e>+n.year||e===+n.year&&f>=+n.month)||!n&&!!a&&(e<+a.year||e===+a.year&&f<=+a.month),isNow:+u.year===e&&+u.month===f})}}return o},o.gntYear=function(e,t,r){if(r=r||{},!T(+(e=+e))||!T(+t))throw new Error("Prop start and len must be a non-negative number");for(var n=r.splitLen||3,a=r.min||null,o=r.max||null,i=[],u=Math.ceil(t/n),h=x(),s=0;s<u;s+=1){i[s]=[];for(var f=0;f<n;f+=1){var c=e+s*n+f;if(t<c-e+1)break;i[s].push({year:w(4,c),canBeChose:!a&&!o||!!a&&!!o&&a<=c&&c<=o||!a&&!!o&&c<=o||!o&&!!a&&a<=c,isNow:+h.year===c})}}return i},o.isLeapYear=c,o.isNonNegInt=T,o.nowDate=x,o.nowTime=function(){var e=new Date;return{hour:w(2,e.getHours()),minute:w(2,e.getMinutes()),second:w(2,e.getSeconds())}},o.objAssign=function(r,n){return r="object"===t(r)?r:{},n="object"===t(n)?n:{},Object.keys(r).concat(Object.keys(n)).reduce(function(e,t){return t in e||(e[t]=void 0!==n[t]?n[t]:r[t]),e},{})},o.parseDate=O,o.parseTime=function(e){if(!e)return null;var t=/^(\d{1,2}):?(\d{1,2})?:?(\d{1,2})?$/;if(!t.test(e))return console.error("Utils.parseDate: Param time is invalid. The right example: 18[:02][:01]"),null;var r=e.match(t);return{hour:w(2,i(+r[1],24)),minute:w(2,i(+r[2]||0,60)),second:w(2,i(+r[3]||0,60))}},o.positiveMod=i,Object.defineProperty(o,"__esModule",{value:!0})});
/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -6,0 +6,0 @@ * Author: 2631541504@qq.com

/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -6,0 +6,0 @@ * Author: 2631541504@qq.com

/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -6,0 +6,0 @@ * Author: 2631541504@qq.com

/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -6,0 +6,0 @@ * Author: 2631541504@qq.com

/**
* Bundle of @livelybone/date-generator
* Generated: 2020-02-28
* Version: 4.1.4
* Version: 4.1.5
* License: MIT

@@ -6,0 +6,0 @@ * Author: 2631541504@qq.com

{
"name": "@livelybone/date-generator",
"version": "4.1.4",
"version": "4.1.5",
"description": "A module that generates calendar, which includes years, months, dates, hours, minutes, seconds",

@@ -5,0 +5,0 @@ "main": "./lib/umd/index.js",

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