UNPKG

ll-package

Version:

2 lines (1 loc) 3.05 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../panels/DecadePanel/index.js"),y=7;function l(e,t){if(!e&&!t)return!0;if(!e||!t)return!1}function b(e,t,a){const r=l(t,a);if(typeof r=="boolean")return r;const o=Math.floor(e.getYear(t)/10),s=Math.floor(e.getYear(a)/10);return o===s}function M(e,t,a){const r=l(t,a);return typeof r=="boolean"?r:e.getYear(t)===e.getYear(a)}function h(e,t){return Math.floor(e.getMonth(t)/3)+1}function Y(e,t,a){const r=l(t,a);return typeof r=="boolean"?r:M(e,t,a)&&h(e,t)===h(e,a)}function E(e,t,a){const r=l(t,a);return typeof r=="boolean"?r:M(e,t,a)&&e.getMonth(t)===e.getMonth(a)}function D(e,t,a){const r=l(t,a);return typeof r=="boolean"?r:e.getYear(t)===e.getYear(a)&&e.getMonth(t)===e.getMonth(a)&&e.getDate(t)===e.getDate(a)}function S(e,t,a){const r=l(t,a);return typeof r=="boolean"?r:e.getHour(t)===e.getHour(a)&&e.getMinute(t)===e.getMinute(a)&&e.getSecond(t)===e.getSecond(a)}function k(e,t,a,r){const o=l(a,r);return typeof o=="boolean"?o:e.locale.getWeek(t,a)===e.locale.getWeek(t,r)}function p(e,t,a){return D(e,t,a)&&S(e,t,a)}function q(e,t,a,r){return!t||!a||!r?!1:!D(e,t,r)&&!D(e,a,r)&&e.isAfter(r,t)&&e.isAfter(a,r)}function W(e,t,a){const r=t.locale.getWeekFirstDay(e),o=t.setDate(a,1),s=t.getWeekDay(o);let n=t.addDate(o,r-s);return t.getMonth(n)===t.getMonth(a)&&t.getDate(n)>1&&(n=t.addDate(n,-7)),n}function _(e,t,a){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;switch(t){case"year":return a.addYear(e,r*10);case"quarter":case"month":return a.addYear(e,r);default:return a.addMonth(e,r)}}function F(e,t){let{generateConfig:a,locale:r,format:o}=t;return typeof o=="function"?o(e):a.locale.format(r.locale,e,o)}function I(e,t){let{generateConfig:a,locale:r,formatList:o}=t;return!e||typeof o[0]=="function"?null:a.locale.parse(r.locale,e,o)}function d(e){let{cellDate:t,mode:a,disabledDate:r,generateConfig:o}=e;if(!r)return!1;const s=(n,u,f)=>{let i=u;for(;i<=f;){let c;switch(n){case"date":{if(c=o.setDate(t,i),!r(c))return!1;break}case"month":{if(c=o.setMonth(t,i),!d({cellDate:c,mode:"month",generateConfig:o,disabledDate:r}))return!1;break}case"year":{if(c=o.setYear(t,i),!d({cellDate:c,mode:"year",generateConfig:o,disabledDate:r}))return!1;break}}i+=1}return!0};switch(a){case"date":case"week":return r(t);case"month":{const u=o.getDate(o.getEndDate(t));return s("date",1,u)}case"quarter":{const n=Math.floor(o.getMonth(t)/3)*3,u=n+2;return s("month",n,u)}case"year":return s("month",0,11);case"decade":{const n=o.getYear(t),u=Math.floor(n/m.DECADE_UNIT_DIFF)*m.DECADE_UNIT_DIFF,f=u+m.DECADE_UNIT_DIFF-1;return s("year",u,f)}}}exports.WEEK_DAY_COUNT=y;exports.formatValue=F;exports.getCellDateDisabled=d;exports.getClosingViewDate=_;exports.getQuarter=h;exports.getWeekStartDate=W;exports.isEqual=p;exports.isInRange=q;exports.isNullEqual=l;exports.isSameDate=D;exports.isSameDecade=b;exports.isSameMonth=E;exports.isSameQuarter=Y;exports.isSameTime=S;exports.isSameWeek=k;exports.isSameYear=M;exports.parseValue=I;