p-64b5872b.js 2.3 KB

123456
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.97
  5. */
  6. import{a as n}from"./p-91755387.js";import{n as t,g as e}from"./p-4ca93e87.js";function a(n,t,e){const a=n.getTime(),r=!(t instanceof Date)||a>=t.getTime(),s=!(e instanceof Date)||a<=e.getTime();return r&&s}function r(n,t,e){if(!(n instanceof Date))return null;const a=n.getTime(),r=t instanceof Date&&a<t.getTime(),s=e instanceof Date&&a>e.getTime();return r?t:s?e:n}function s(n,t=!1){if(n instanceof Date)return n;if(!n||"string"!=typeof n)return null;const e=n.split(/[: T-]/).map(parseFloat),a=new Date(e[0],(e[1]||1)-1,e[2]||1);if(a.setFullYear(e[0]),isNaN(a.getTime()))throw new Error(`Invalid ISO 8601 date: "${n}"`);return t?l(a):a}function o(n){return"string"==typeof n?n:n instanceof Date?new Date(n.getTime()-6e4*n.getTimezoneOffset()).toISOString().split("T")[0]:""}function i(n,t){return n instanceof Date&&t instanceof Date&&n.getDate()===t.getDate()&&n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear()}function c(n){const t=n.getMonth(),e=new Date(n);return e.setMonth(t-1),t===e.getMonth()?new Date(n.getFullYear(),t,0):e}function f(n){const t=n.getMonth(),e=new Date(n);return e.setMonth(t+1),(t+2)%7==e.getMonth()%7?new Date(n.getFullYear(),t+2,0):e}function u(n,e){const{separator:a,unitOrder:r}=e,s=p(r),o=n.split(a).map((n=>t.delocalize(n)));return{day:parseInt(o[s.indexOf("d")]),month:parseInt(o[s.indexOf("m")])-1,year:parseInt(o[s.indexOf("y")])}}function p(n){const t=n.toLowerCase();return["d","m","y"].sort(((n,e)=>t.indexOf(n)-t.indexOf(e)))}function D(n,t){return(n.getTime()-t.getTime())/864e5}function l(n){return n.setHours(23,59,59,999),n}const d={},h={};async function m(t){const a=e(t);if(d[a])return d[a];h[a]||(h[a]=fetch(n(`./assets/date-picker/nls/${a}.json`)).then((n=>n.json())).catch((()=>(console.error(`Translations for "${a}" not found or invalid, falling back to english`),m("en")))));const r=await h[a];return d[a]=r,r}function w(n){return n.map(((n,t)=>s(n,1===t)))}const y=2,g={nextMonth:"Next month",prevMonth:"Previous month",year:"Year"};export{y as H,g as T,s as a,r as b,m as c,o as d,i as e,D as f,w as g,p as h,a as i,c as j,f as n,u as p,l as s}