woocommerce/packages/woocommerce-admin/dist/date/index.js

1 line
19 KiB
JavaScript
Raw Normal View History

2021-12-10 12:03:04 +00:00
this.wc=this.wc||{},this.wc.date=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=444)}({2:function(e,t){e.exports=window.wp.i18n},32:function(e,t,r){"use strict";var o=r(67),n=r(68),a=r(39);e.exports={formats:a,parse:n,stringify:o}},39:function(e,t,r){"use strict";var o=String.prototype.replace,n=/%20/g,a="RFC1738",i="RFC3986";e.exports={default:i,formatters:{RFC1738:function(e){return o.call(e,n,"+")},RFC3986:function(e){return String(e)}},RFC1738:a,RFC3986:i}},4:function(e,t){e.exports=window.lodash},444:function(e,t,r){"use strict";r.r(t),r.d(t,"isoDateFormat",(function(){return s})),r.d(t,"defaultDateTimeFormat",(function(){return u})),r.d(t,"presetValues",(function(){return l})),r.d(t,"periods",(function(){return d})),r.d(t,"appendTimestamp",(function(){return f})),r.d(t,"toMoment",(function(){return m})),r.d(t,"getRangeLabel",(function(){return p})),r.d(t,"getStoreTimeZoneMoment",(function(){return y})),r.d(t,"getLastPeriod",(function(){return b})),r.d(t,"getCurrentPeriod",(function(){return h})),r.d(t,"getDateParamsFromQuery",(function(){return g})),r.d(t,"getCurrentDates",(function(){return j})),r.d(t,"getDateDifferenceInDays",(function(){return _})),r.d(t,"getPreviousDate",(function(){return k})),r.d(t,"getAllowedIntervalsForQuery",(function(){return S})),r.d(t,"getIntervalForQuery",(function(){return Y})),r.d(t,"getChartTypeForQuery",(function(){return D})),r.d(t,"dayTicksThreshold",(function(){return x})),r.d(t,"weekTicksThreshold",(function(){return M})),r.d(t,"defaultTableDateFormat",(function(){return L})),r.d(t,"getDateFormatsForInterval",(function(){return E})),r.d(t,"loadLocaleData",(function(){return P})),r.d(t,"dateValidationMessages",(function(){return N})),r.d(t,"validateDateInputForRange",(function(){return T}));var o=r(9),n=r.n(o),a=r(4),i=r(2),c=r(32);const s="YYYY-MM-DD",u="YYYY-MM-DDTHH:mm:ss",l=[{value:"today",label:Object(i.__)("Today",'woocommerce')},{value:"yesterday",label:Object(i.__)("Yesterday",'woocommerce')},{value:"week",label:Object(i.__)("Week to date",'woocommerce')},{value:"last_week",label:Object(i.__)("Last week",'woocommerce')},{value:"month",label:Object(i.__)("Month to date",'woocommerce')},{value:"last_month",label:Object(i.__)("Last month",'woocommerce')},{value:"quarter",label:Object(i.__)("Quarter to date",'woocommerce')},{value:"last_quarter",label:Object(i.__)("Last quarter",'woocommerce')},{value:"year",label:Object(i.__)("Year to date",'woocommerce')},{value:"last_year",label:Object(i.__)("Last year",'woocommerce')},{value:"custom",label:Object(i.__)("Custom",'woocommerce')}],d=[{value:"previous_period",label:Object(i.__)("Previous period",'woocommerce')},{value:"previous_year",label:Object(i.__)("Previous year",'woocommerce')}],f=(e,t)=>{if("start"===t)return e.startOf("day").format(u);if("now"===t)return e.format(u);if("end"===t)return e.endOf("day").format(u);throw new Error("appendTimestamp requires second parameter to be either `start`, `now` or `end`")};function m(e,t){if(n.a.isMoment(t))return t.isValid()?t:null;if("string"==typeof t){const r=n()(t,[s,e],!0);return r.isValid()?r:null}throw new Error("toMoment requires a string to be passed as an argument")}function p(e,t){const r=e.year()===t.year(),o=r&&e.month