UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

1 lines 2.35 kB
import{e as n}from"./p-c5b7f45e.js";import{a as t}from"./p-42da4366.js";const e={},r={};async function a(o){const s=function(n=""){if(t.indexOf(n)>-1)return n;{const e=n.split("-")[0];return t.indexOf(e)>-1?e:"en"}}(o);if(e[s])return e[s];r[s]||(r[s]=fetch(n(`./assets/calcite-date-picker/nls/${s}.json`)).then((n=>n.json())).catch((()=>(console.error(`Translations for "${s}" not found or invalid, falling back to english`),a("en")))));const i=await r[s];return e[s]=i,i}function o(n,t,e){const r=n.getTime(),a=!(t instanceof Date)||r>=t.getTime(),o=!(e instanceof Date)||r<=e.getTime();return a&&o}function s(n,t,e){if(!(n instanceof Date))return null;const r=n.getTime(),a=t instanceof Date&&r<t.getTime(),o=e instanceof Date&&r>e.getTime();return a?t:o?e:n}function i(n){if(n instanceof Date)return n;if(!n||"string"!=typeof n)return null;const t=n.split(/[: T-]/).map(parseFloat),e=new Date(t[0],(t[1]||1)-1,t[2]||1);if(e.setFullYear(t[0]),isNaN(e.getTime()))throw new Error(`Invalid ISO 8601 date: "${n}"`);return e}function c(n){return"string"==typeof n?n:n instanceof Date?n.toISOString().split("T")[0]:""}function u(n,t){return n instanceof Date&&t instanceof Date&&n.getDate()===t.getDate()&&n.getMonth()===t.getMonth()&&n.getFullYear()===t.getFullYear()}function f(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 p(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 l(n,t){return String(n).split("").map((n=>t.numerals[n])).join("")}function D(n,t){return parseInt(n.split("").map((n=>"0123456789"[t.numerals.indexOf(n)])).filter((n=>n)).join(""))}function d(n,t){const{separator:e,unitOrder:r}=t,a=h(r),o=function(n=""){return n.replace(/[\u0660-\u0669]/g,(n=>n.charCodeAt(0)-1632)).replace(/[\u06f0-\u06f9]/g,(n=>n.charCodeAt(0)-1776))}(n).split(e);return{day:parseInt(o[a.indexOf("d")]),month:parseInt(o[a.indexOf("m")])-1,year:parseInt(o[a.indexOf("y")])}}function h(n){const t=n.toLowerCase();return["d","m","y"].sort(((n,e)=>t.indexOf(n)-t.indexOf(e)))}function m(n,t){const e=n.getTime(),r=t.getTime();return 1e3*Math.abs(e-r)*60*60*24}const g={nextMonth:"next month",prevMonth:"previous month"};export{g as T,s as a,m as b,c,i as d,h as e,f,a as g,D as h,o as i,l,p as n,d as p,u as s}