UNPKG

@kelvininc/ui-components

Version:
1 lines 1.46 kB
import"./p-DzZLIMy0.js";import"./p-DwRzddFC.js";import"./p-DVds6a5Z.js";import{g as t,h as e}from"./p-CojoW2Y2.js";import"./p-SVedE_O8.js";import"./p-BcMhjKoS.js";import"./p-Do0EyoO8.js";import"./p-CBuzk8fR.js";import"./p-DHk26cGe.js";import"./p-7ioMFMb5.js";import{n,i,j as o,k as r}from"./p-CMC2Wc9b.js";import{D as s}from"./p-DulScpJD.js";const a=(e,n)=>{switch(e.comparisonConfig){case t.StartDateEndDate:return u(e,n);case t.StartDate||t.EndDate:return p(e,n);case t.AbsoluteAmountOfUnits:return m(e,n);default:return c(e,n)}},u=(t,e)=>{const i=n(e,t.startDate.dateFormat,t.startDate.date),o=n(e,t.endDate.dateFormat,t.endDate.date);return l(i,o)},p=(t,e)=>{const o=i(e),r=n(e,t.startDate.dateFormat,t.startDate.date);return l(o,r)},m=(t,e)=>{const n=i(e),{unit:r,amount:s,unitReference:a}=t.startDate,{unit:u,amount:p,unitReference:m}=t.endDate,c=j(o(n,s,r),r,a),f=j(o(n,p,u),u,m);return l(c,f)},c=(t,e)=>{const n=i(e),{amount:r,unit:s,unitReference:a}=t.startDate,u=j(o(n,r,s),s,a);return l(n,u)},j=(t,n,i)=>i?i===e.StartOfUnit?t.startOf(n):t.endOf(n):t,l=(t,e)=>r(t,e)?[t,e]:[e,t],f=([t,e])=>[t.valueOf(),e.valueOf()];var g=Object.freeze({__proto__:null,buildAbsoluteAmountOfUnitsConfigRange:m,buildDayjsRange:l,buildOptionRange:a,buildRelativeAmountOfUnitsConfigRange:c,buildSingleDateConfigRange:p,buildStartDateEndDateConfigRange:u,buildTimestampRange:f,getRelativeTimeOption:(t,e=s)=>e.flat().find((e=>e.value===t))});export{f as a,a as b,g as r}