@foxy.io/elements 1.53.2 → 1.53.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as e}from"./shared-2bb1f0f4.js";import{_ as t,B as r}from"./shared-8f9014ff.js";import{c as a,h as s,s as i}from"./shared-ba5c42c7.js";import{c as n}from"./shared-4e709717.js";import{l as o}from"./shared-d0aed1c1.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-9d4fecb9.js";import{I as l}from"./shared-ad26f72d.js";import{s as d}from"./shared-af6ccc54.js";import{a as u}from"./shared-887ac0b0.js";import"./shared-5212ef4f.js";import"./shared-9b35fe34.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-53e42a77.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-9687ab7b.js";import"./shared-0fd68dc0.js";import"./shared-8d8975d5.js";import"./shared-99c53365.js";import"./shared-db623837.js";import"./shared-6cdfb858.js";import"./shared-0f92b865.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-9a3bf65c.js";import"./shared-7892fd3f.js";import"./shared-a5d6db21.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./shared-515003f6.js";import"./shared-609c9693.js";import"./shared-058530fc.js";import"./foxy-copy-to-clipboard.js";import"./shared-19073761.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let h,m,p,c=e=>e;customElements.define("foxy-internal-native-date-control",class extends e{constructor(){super(...arguments),this.format="date",this.__isErrorVisible=!1}static get properties(){return t(t({},super.properties),{},{format:{},__isErrorVisible:{attribute:!1}})}static get styles(){return[super.styles,a(h||(h=c`input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}`))]}reportValidity(){this.__isErrorVisible=!0,super.reportValidity()}renderControl(){return s(m||(m=c` <div class="leading-xs"> <div class="flex items-center gap-xs"> <label class="text-m text-body flex-1 whitespace-nowrap" for="input">${0}</label> <input placeholder="${0}" class="${0}" type="${0}" id="input" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @blur="${0}" @input="${0}"> <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> <div style="max-width:32rem"> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> </div> `),this.label,this.placeholder,n({"appearance-none text-right bg-transparent transition-colors":!0,"text-m rounded-s focus-outline-none":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.format,o(this._value),this.disabled,this.readonly,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(()=>this.__isErrorVisible=!0),(e=>{e.stopPropagation(),this._value=e.target.value}),this.t("clear"),n({"flex-shrink-0 rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!this._value,(()=>{this._value="",this.dispatchEvent(new CustomEvent("clear"))}),i(p||(p=c`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`)),this.helperText,!this.__isErrorVisible||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}_handleHostClick(e){var t;const r=e.composedPath(),a=new Set(["INPUT","LABEL","BUTTON"]);r.some((e=>a.has(e.tagName)))||(null===(t=this.renderRoot.querySelector("input"))||void 0===t||t.focus(),super._handleHostClick(e))}});const _=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function f(e=new Date){const t=e.getMonth(),r=_.findIndex((e=>e.includes(t))),a=0===r?_.length-1:r-1,s=e.getFullYear()-(0===r?1:0),i=_[a][0],n=d(s,i),o=_[a][2];return{start:n,end:new Date(
|
|
1
|
+
import{I as e}from"./shared-2bb1f0f4.js";import{_ as t,B as r}from"./shared-8f9014ff.js";import{c as a,h as s,s as i}from"./shared-ba5c42c7.js";import{c as n}from"./shared-4e709717.js";import{l as o}from"./shared-d0aed1c1.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-9d4fecb9.js";import{I as l}from"./shared-ad26f72d.js";import{s as d}from"./shared-af6ccc54.js";import{a as u}from"./shared-887ac0b0.js";import"./shared-5212ef4f.js";import"./shared-9b35fe34.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-53e42a77.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-9687ab7b.js";import"./shared-0fd68dc0.js";import"./shared-8d8975d5.js";import"./shared-99c53365.js";import"./shared-db623837.js";import"./shared-6cdfb858.js";import"./shared-0f92b865.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-9a3bf65c.js";import"./shared-7892fd3f.js";import"./shared-a5d6db21.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./shared-515003f6.js";import"./shared-609c9693.js";import"./shared-058530fc.js";import"./foxy-copy-to-clipboard.js";import"./shared-19073761.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let h,m,p,c=e=>e;customElements.define("foxy-internal-native-date-control",class extends e{constructor(){super(...arguments),this.format="date",this.__isErrorVisible=!1}static get properties(){return t(t({},super.properties),{},{format:{},__isErrorVisible:{attribute:!1}})}static get styles(){return[super.styles,a(h||(h=c`input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}`))]}reportValidity(){this.__isErrorVisible=!0,super.reportValidity()}renderControl(){return s(m||(m=c` <div class="leading-xs"> <div class="flex items-center gap-xs"> <label class="text-m text-body flex-1 whitespace-nowrap" for="input">${0}</label> <input placeholder="${0}" class="${0}" type="${0}" id="input" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @blur="${0}" @input="${0}"> <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> <div style="max-width:32rem"> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> </div> `),this.label,this.placeholder,n({"appearance-none text-right bg-transparent transition-colors":!0,"text-m rounded-s focus-outline-none":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.format,o(this._value),this.disabled,this.readonly,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(()=>this.__isErrorVisible=!0),(e=>{e.stopPropagation(),this._value=e.target.value}),this.t("clear"),n({"flex-shrink-0 rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!this._value,(()=>{this._value="",this.dispatchEvent(new CustomEvent("clear"))}),i(p||(p=c`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`)),this.helperText,!this.__isErrorVisible||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}_handleHostClick(e){var t;const r=e.composedPath(),a=new Set(["INPUT","LABEL","BUTTON"]);r.some((e=>a.has(e.tagName)))||(null===(t=this.renderRoot.querySelector("input"))||void 0===t||t.focus(),super._handleHostClick(e))}});const _=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function f(e=new Date){const t=e.getMonth(),r=_.findIndex((e=>e.includes(t))),a=0===r?_.length-1:r-1,s=e.getFullYear()-(0===r?1:0),i=_[a][0],n=d(s,i,1),o=_[a][2];return{start:n,end:new Date(d(s,o+1,1).getTime()-1)}}function g(e=new Date){const t=e.getMonth(),r=_.findIndex((e=>e.includes(t))),a=_[r][0],s=d(e.getFullYear(),a,1),i=_[r][2];return{start:s,end:new Date(d(e.getFullYear(),i+1,1).getTime()-1)}}function v(e=new Date){return{start:d(e.getFullYear(),e.getMonth()-1,1),end:new Date(d(e.getFullYear(),e.getMonth(),1).getTime()-1)}}function b(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),1),end:new Date(d(e.getFullYear(),e.getMonth()+1,1).getTime()-1)}}function y(e=new Date){return{start:d(e.getFullYear()-1,0,1),end:new Date(d(e.getFullYear(),0,1).getTime()-1)}}function x(e=new Date){return{start:d(e.getFullYear(),0,1),end:new Date(d(e.getFullYear()+1,0,1).getTime()-1)}}function w(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),e.getDate()-365),end:new Date(d(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function $(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),e.getDate()-30),end:new Date(d(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function j(e){return`${e.getFullYear().toString().padStart(4,"0")}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`}function S(e){var t,r;return null!==(r=null===(t=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.exec(e))||void 0===t?void 0:t[0])&&void 0!==r?r:""}function V(e){var t,r;return null!==(r=null===(t=/^\d{4}-\d{2}-\d{2}/.exec(e))||void 0===t?void 0:t[0])&&void 0!==r?r:""}let T,D=e=>e;const F=u(l,"report-form");class Y extends F{constructor(){super(...arguments),this.__showRangeTime=!1,this.__rawPresetOptions=[t({value:"0",label:"option_previous_quarter"},f()),t({value:"1",label:"option_previous_month"},v()),t({value:"2",label:"option_previous_year"},y()),t({value:"3",label:"option_this_quarter"},g()),t({value:"4",label:"option_this_month"},b()),t({value:"5",label:"option_this_year"},x()),t({value:"6",label:"option_last_365_days"},w()),t({value:"7",label:"option_last_30_days"},$())],this.__presetOptions=JSON.stringify([...this.__rawPresetOptions,{value:"custom",label:"option_custom"}]),this.__nameOptions=JSON.stringify([{value:"complete",label:"option_complete"},{value:"customers",label:"option_customers"},{value:"customers_ltv",label:"option_customers_ltv"},{value:"transactions",label:"option_transactions"}]),this.__datetimePreciseGetValue=()=>this.__showRangeTime,this.__datetimePreciseSetValue=e=>{this.__showRangeTime=e},this.__datetimeStartGetValue=()=>{const e=this.form.datetime_start;return e?this.__showRangeTime||this.data?S(e):V(e):""},this.__datetimeStartSetValue=e=>{var t;const r=this.__showRangeTime?`${null!==(t=e.split("T")[1])&&void 0!==t?t:"00:00"}:00`:"00:00:00";this.edit({datetime_start:`${e.split("T")[0]}T${r}`})},this.__datetimeEndGetValue=()=>{const e=this.form.datetime_end;return e?this.__showRangeTime||this.data?S(e):V(e):""},this.__datetimeEndSetValue=e=>{var t;const r=this.__showRangeTime?`${null!==(t=e.split("T")[1])&&void 0!==t?t:"23:59"}:59`:"23:59:59";this.edit({datetime_end:`${e.split("T")[0]}T${r}`})},this.__presetGetValue=()=>{var e,t;return null!==(t=null===(e=this.__rawPresetOptions.find((e=>{const{datetime_end:t,datetime_start:r}=this.form;return r&&t&&j(e.start)===r&&j(e.end)===t})))||void 0===e?void 0:e.value)&&void 0!==t?t:"custom"},this.__presetSetValue=e=>{const t=this.__rawPresetOptions.find((t=>t.value===e));t&&this.edit({datetime_start:j(t.start),datetime_end:j(t.end)})}}static get properties(){return t(t({},super.properties),{},{__showRangeTime:{attribute:!1}})}static get v8n(){return[({datetime_start:e})=>!!e||"datetime-start:v8n_required",({datetime_end:e})=>!!e||"datetime-end:v8n_required",({name:e})=>!!e||"name:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.data&&e.unshift("name","preset","datetime-precise","datetime-start","datetime-end"),new r(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data&&e.unshift("preset","datetime-precise"),new r(e.join(" ").trim())}renderBody(){var e;return s(T||(T=D` ${0} <foxy-internal-summary-control infer="" label="" helper-text=""> <foxy-internal-select-control helper-text="${0}" options="${0}" layout="summary-item" infer="name"> </foxy-internal-select-control> <foxy-internal-select-control options="${0}" layout="summary-item" infer="preset" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="" label="" helper-text=""> <foxy-internal-native-date-control format="${0}" infer="datetime-start" .getValue="${0}" .setValue="${0}"> </foxy-internal-native-date-control> <foxy-internal-native-date-control format="${0}" infer="datetime-end" .getValue="${0}" .setValue="${0}"> </foxy-internal-native-date-control> <foxy-internal-switch-control infer="datetime-precise" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.t(`name.helper_text_${null!==(e=this.form.name)&&void 0!==e?e:"none"}`),this.__nameOptions,this.__presetOptions,this.__presetGetValue,this.__presetSetValue,this.__showRangeTime||this.data?"datetime-local":"date",this.__datetimeStartGetValue,this.__datetimeStartSetValue,this.__showRangeTime||this.data?"datetime-local":"date",this.__datetimeEndGetValue,this.__datetimeEndSetValue,this.__datetimePreciseGetValue,this.__datetimePreciseSetValue,super.renderBody())}}customElements.define("foxy-report-form",Y);export{Y as ReportForm};
|
|
@@ -11,38 +11,38 @@ export function getPreviousQuarter(now = new Date()) {
|
|
|
11
11
|
const previousQuarter = currentQuarter === 0 ? quarters.length - 1 : currentQuarter - 1;
|
|
12
12
|
const previousQuarterYear = now.getFullYear() - (currentQuarter === 0 ? 1 : 0);
|
|
13
13
|
const previousQuarterStart = quarters[previousQuarter][0];
|
|
14
|
-
const start = safeDate(previousQuarterYear, previousQuarterStart);
|
|
14
|
+
const start = safeDate(previousQuarterYear, previousQuarterStart, 1);
|
|
15
15
|
const previousQuarterEnd = quarters[previousQuarter][2];
|
|
16
|
-
const end = new Date(
|
|
16
|
+
const end = new Date(safeDate(previousQuarterYear, previousQuarterEnd + 1, 1).getTime() - 1);
|
|
17
17
|
return { start, end };
|
|
18
18
|
}
|
|
19
19
|
export function getCurrentQuarter(now = new Date()) {
|
|
20
20
|
const currentMonth = now.getMonth();
|
|
21
21
|
const currentQuarter = quarters.findIndex(months => months.includes(currentMonth));
|
|
22
22
|
const currentQuarterStart = quarters[currentQuarter][0];
|
|
23
|
-
const start = safeDate(now.getFullYear(), currentQuarterStart);
|
|
23
|
+
const start = safeDate(now.getFullYear(), currentQuarterStart, 1);
|
|
24
24
|
const currentQuarterEnd = quarters[currentQuarter][2];
|
|
25
|
-
const end = new Date(safeDate(now.getFullYear(), currentQuarterEnd + 1).getTime() - 1);
|
|
25
|
+
const end = new Date(safeDate(now.getFullYear(), currentQuarterEnd + 1, 1).getTime() - 1);
|
|
26
26
|
return { start, end };
|
|
27
27
|
}
|
|
28
28
|
export function getPreviousMonth(now = new Date()) {
|
|
29
|
-
const start = safeDate(now.getFullYear(), now.getMonth() - 1);
|
|
30
|
-
const end = new Date(safeDate(now.getFullYear(), now.getMonth()).getTime() - 1);
|
|
29
|
+
const start = safeDate(now.getFullYear(), now.getMonth() - 1, 1);
|
|
30
|
+
const end = new Date(safeDate(now.getFullYear(), now.getMonth(), 1).getTime() - 1);
|
|
31
31
|
return { start, end };
|
|
32
32
|
}
|
|
33
33
|
export function getCurrentMonth(now = new Date()) {
|
|
34
|
-
const start = safeDate(now.getFullYear(), now.getMonth());
|
|
35
|
-
const end = new Date(safeDate(now.getFullYear(), now.getMonth() + 1).getTime() - 1);
|
|
34
|
+
const start = safeDate(now.getFullYear(), now.getMonth(), 1);
|
|
35
|
+
const end = new Date(safeDate(now.getFullYear(), now.getMonth() + 1, 1).getTime() - 1);
|
|
36
36
|
return { start, end };
|
|
37
37
|
}
|
|
38
38
|
export function getPreviousYear(now = new Date()) {
|
|
39
|
-
const start = safeDate(now.getFullYear() - 1, 0);
|
|
40
|
-
const end = new Date(safeDate(now.getFullYear(), 0).getTime() - 1);
|
|
39
|
+
const start = safeDate(now.getFullYear() - 1, 0, 1);
|
|
40
|
+
const end = new Date(safeDate(now.getFullYear(), 0, 1).getTime() - 1);
|
|
41
41
|
return { start, end };
|
|
42
42
|
}
|
|
43
43
|
export function getCurrentYear(now = new Date()) {
|
|
44
|
-
const start = safeDate(now.getFullYear(), 0);
|
|
45
|
-
const end = new Date(safeDate(now.getFullYear() + 1, 0).getTime() - 1);
|
|
44
|
+
const start = safeDate(now.getFullYear(), 0, 1);
|
|
45
|
+
const end = new Date(safeDate(now.getFullYear() + 1, 0, 1).getTime() - 1);
|
|
46
46
|
return { start, end };
|
|
47
47
|
}
|
|
48
48
|
export function getLast365Days(now = new Date()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/elements/public/ReportForm/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAMpD,MAAM,QAAQ,GAAS;IACrB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACT,CAAC,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EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAgB;;IACpD,mBAAO,sCAAsC,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAG,CAAC,oCAAK,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,QAAgB;;IAC1D,mBAAO,gCAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAG,CAAC,oCAAK,EAAE,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB;;IAChD,mBAAO,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAG,CAAC,oCAAK,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import { safeDate } from '../../../utils/safe-date';\n\ntype Quarter = [number, number, number];\ntype Year = [Quarter, Quarter, Quarter, Quarter];\ntype Range = { start: Date; end: Date };\n\nconst quarters: Year = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [9, 10, 11],\n];\n\nexport function getPreviousQuarter(now = new Date()): Range {\n const currentMonth = now.getMonth();\n const currentQuarter = quarters.findIndex(months => months.includes(currentMonth));\n const previousQuarter = currentQuarter === 0 ? quarters.length - 1 : currentQuarter - 1;\n const previousQuarterYear = now.getFullYear() - (currentQuarter === 0 ? 1 : 0);\n\n const previousQuarterStart = quarters[previousQuarter][0];\n const start = safeDate(previousQuarterYear, previousQuarterStart, 1);\n\n const previousQuarterEnd = quarters[previousQuarter][2];\n const end = new Date(safeDate(previousQuarterYear, previousQuarterEnd + 1, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getCurrentQuarter(now = new Date()): Range {\n const currentMonth = now.getMonth();\n const currentQuarter = quarters.findIndex(months => months.includes(currentMonth));\n\n const currentQuarterStart = quarters[currentQuarter][0];\n const start = safeDate(now.getFullYear(), currentQuarterStart, 1);\n\n const currentQuarterEnd = quarters[currentQuarter][2];\n const end = new Date(safeDate(now.getFullYear(), currentQuarterEnd + 1, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getPreviousMonth(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth() - 1, 1);\n const end = new Date(safeDate(now.getFullYear(), now.getMonth(), 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getCurrentMonth(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth(), 1);\n const end = new Date(safeDate(now.getFullYear(), now.getMonth() + 1, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getPreviousYear(now = new Date()): Range {\n const start = safeDate(now.getFullYear() - 1, 0, 1);\n const end = new Date(safeDate(now.getFullYear(), 0, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getCurrentYear(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), 0, 1);\n const end = new Date(safeDate(now.getFullYear() + 1, 0, 1).getTime() - 1);\n\n return { start, end };\n}\n\nexport function getLast365Days(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth(), now.getDate() - 365);\n const end = new Date(\n safeDate(now.getFullYear(), now.getMonth(), now.getDate() + 1).getTime() - 1\n );\n\n return { start, end };\n}\n\nexport function getLast30Days(now = new Date()): Range {\n const start = safeDate(now.getFullYear(), now.getMonth(), now.getDate() - 30);\n const end = new Date(\n safeDate(now.getFullYear(), now.getMonth(), now.getDate() + 1).getTime() - 1\n );\n\n return { start, end };\n}\n\nexport function toAPIDateTime(date: Date): string {\n const YYYY = date.getFullYear().toString().padStart(4, '0');\n const MM = (date.getMonth() + 1).toString().padStart(2, '0');\n const DD = date.getDate().toString().padStart(2, '0');\n const hh = date.getHours().toString().padStart(2, '0');\n const mm = date.getMinutes().toString().padStart(2, '0');\n const ss = date.getSeconds().toString().padStart(2, '0');\n\n return `${YYYY}-${MM}-${DD}T${hh}:${mm}:${ss}`;\n}\n\nexport function toDateTimePickerValue(apiValue: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}/.exec(apiValue)?.[0] ?? '';\n}\n\nexport function toNativeDateTimePickerValue(apiValue: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}/.exec(apiValue)?.[0] ?? '';\n}\n\nexport function toDatePickerValue(apiValue: string): string {\n return /^\\d{4}-\\d{2}-\\d{2}/.exec(apiValue)?.[0] ?? '';\n}\n"]}
|