@nervure/datetime 0.0.0-stage → 0.2.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+ # Changelog of @nervure/datetime
2
+
3
+ Versions follow [semantic versioning](https://semver.org). Before 1.0, a minor version may rename an option.
4
+
5
+ ## 0.2.0 - 2026-12-04
6
+
7
+ ### Added
8
+ - **The period block**, `mode: 'period'`: tabs for day, week, month, quarter, year and a free range (`granularities`, `granularity`). The value is always a first and a last day. It opens on the tab that fits the value, keeps the pick when the tab changes, and sends a ready-made period to its tab.
9
+ - **Comparison**, `compare`: the same period last year or the period just before, chosen by the reader (`true`) or fixed. The selection gives `compare` with its two instants and its two days, and `granularity`.
10
+ - **Orientation**, `orientation: 'vertical'`: periods above the calendar and months stacked, for a side panel.
11
+ - Five more words in the 28 languages: Custom, Compare to, Same period last year, Previous period, None.
12
+
13
+ ### Fixed
14
+ - ARIA states are written out (`aria-selected="false"`, `aria-pressed="true"`): they were empty attributes.
15
+
16
+ ## 0.1.0 - 2026-12-04
17
+
18
+ ### Added
19
+ - First version. A date and time picker with no dependency, about 16 kB gzipped.
20
+ - Nine picks: one day, a range, several days, an ISO week, a month, a quarter, a year, a time, and the hour with a day or a range (`time: true`).
21
+ - Values are ISO 8601 text (`2026-12-04`, `2026-W49`, `2026-Q4`, `2026-12-04T14:30+01:00`). Each selection also gives its two instants, `start` and `end` (excluded), ready for a query.
22
+ - Time zones: `local`, `UTC` or any IANA name, with the zone data of the browser. Days of 23 and 25 hours are right. `zones` lets the reader switch, and the instant stays.
23
+ - Languages: month names, day names, digits, first day of the week and 12 or 24 hours from the browser; the words of the picker in 28 languages of Europe and Arabic, right to left.
24
+ - Ready-made periods for ranges (`presets`): today, last 7 and 30 days, this and last week, month, quarter and year, year to date, and your own.
25
+ - Limits (`min`, `max`), closed days (`disable`), one to three months side by side, week numbers.
26
+ - Keyboard and screen readers: dialog, grid, arrows, Home and End, Page up and down, Escape.
27
+ - Look: CSS variables on `.nv-dt`, light and dark themes, `accent`.
28
+ - Entries: `createDatePicker`, `<nv-datetime>` (`@nervure/datetime/element`), React (`/react`), Vue (`/vue`), one-file CDN build, `style.css`.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ali Ben Macha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,80 @@
1
- # Temporary Holding Version
1
+ # @nervure/datetime
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A date and time picker from the [nervure](https://nervurejs.github.io) family. It picks one day, a range, several days, a week, a month, a quarter, a year or a time, in any time zone and 28 languages. Plain JavaScript, web component, React and Vue. MIT, no dependency, about 18 kB gzipped.
4
+
5
+ [Examples](https://nervurejs.github.io/datetime/) · [Guide](https://nervurejs.github.io/datetime/guide)
6
+
7
+ ```sh
8
+ npm install @nervure/datetime
9
+ ```
10
+
11
+ ```js
12
+ import { createDatePicker } from '@nervure/datetime';
13
+
14
+ createDatePicker('#period', {
15
+ mode: 'range',
16
+ presets: true,
17
+ locale: 'fr',
18
+ zone: 'Europe/Paris',
19
+ onChange: ({ value, start, end }) => load(start, end), // two instants, end excluded
20
+ });
21
+ ```
22
+
23
+ On a text field, the panel opens under it. On any other element, the calendar is drawn inside it.
24
+
25
+ ## What it picks
26
+
27
+ | Mode | Value |
28
+ |---|---|
29
+ | `date` | `2026-12-04` |
30
+ | `date` with `time: true` | `2026-12-04T14:30+01:00` |
31
+ | `range` | `{ start: '2026-12-01', end: '2026-12-31' }` |
32
+ | `multiple` | `['2026-12-04', '2026-12-11']` |
33
+ | `week` | `2026-W49` |
34
+ | `month` | `2026-12` |
35
+ | `quarter` | `2026-Q4` |
36
+ | `year` | `2026` |
37
+ | `time` | `14:30` |
38
+ | `period` | `{ start: '2026-10-01', end: '2026-12-31' }`, picked on tabs: day, week, month, quarter, year, free range |
39
+
40
+ Every value is ISO 8601 text. Each selection also gives `start` and `end`, two instants in the zone, so a query for a quarter or a week needs no date arithmetic.
41
+
42
+ ## The period block
43
+
44
+ `mode: 'period'` is one block for the date filter of a dashboard: tabs for the kind of period, ready-made periods, and a comparison with last year or the period before. The value is always a first and a last day.
45
+
46
+ ```js
47
+ createDatePicker('#filter', { mode: 'period', compare: true, orientation: 'vertical' });
48
+ ```
49
+
50
+ ## Web component, React, Vue
51
+
52
+ ```html
53
+ <script type="module">import '@nervure/datetime/element';</script>
54
+ <nv-datetime mode="quarter" value="2026-Q4" locale="fr" name="quarter"></nv-datetime>
55
+ ```
56
+
57
+ ```jsx
58
+ import { DateTimePicker } from '@nervure/datetime/react';
59
+ <DateTimePicker mode="range" presets value={value} onChange={(s) => setValue(s.value)} />;
60
+ ```
61
+
62
+ ```vue
63
+ <NvDateTime v-model="day" :options="{ locale: 'ar-TN', zone: 'Africa/Tunis' }" />
64
+ ```
65
+
66
+ The web component works as it is in Svelte, Angular, Astro, Twig and Blade.
67
+
68
+ ## Time zones and languages
69
+
70
+ `zone` is `local`, `UTC` or an IANA name. The picker uses the zone data of the browser and ships none. Days of 23 and 25 hours are right. With `zones`, the reader switches zone and the instant stays.
71
+
72
+ `locale` is a BCP 47 tag. Month and day names, digits, the first day of the week and the 12 or 24 hour clock come from the browser. The words of the picker are written in 28 languages of Europe and in Arabic, which reads right to left. `labels` replaces any word.
73
+
74
+ ## Look
75
+
76
+ Everything is a CSS variable on `.nv-dt`: `--nv-dt-accent`, `--nv-dt-bg`, `--nv-dt-ink`, `--nv-dt-radius`, `--nv-dt-cell`, and more in the [guide](https://nervurejs.github.io/datetime/guide#look). Light and dark themes, and `accent` for the main colour.
77
+
78
+ ## License
79
+
80
+ MIT, Ali Ben Macha.
@@ -0,0 +1,74 @@
1
+ /*! @nervure/datetime | MIT | https://nervurejs.github.io/datetime */
2
+ "use strict";(()=>{var Lt=Object.defineProperty;var Nt=(e,n,t)=>n in e?Lt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var be=(e,n,t)=>Nt(e,typeof n!="symbol"?n+"":n,t);var U=(e,n=2)=>String(e).padStart(n,"0"),q=e=>Math.floor(Date.UTC(e.y,e.m-1,e.d)/864e5);function jt(e){let n=new Date(e*864e5);return{y:n.getUTCFullYear(),m:n.getUTCMonth()+1,d:n.getUTCDate()}}var j=(e,n)=>q(e)-q(n),B=(e,n)=>!!e&&!!n&&e.y===n.y&&e.m===n.m&&e.d===n.d,A=(e,n)=>jt(q(e)+n),le=(e,n)=>new Date(Date.UTC(e,n,0)).getUTCDate();function N(e,n){let t=e.y*12+(e.m-1)+n,i=Math.floor(t/12),l=(t%12+12)%12+1;return{y:i,m:l,d:Math.min(e.d,le(i,l))}}var ke=e=>(new Date(Date.UTC(e.y,e.m-1,e.d)).getUTCDay()+6)%7,H=(e,n)=>A(e,-((ke(e)-n+7)%7));function de(e){let n=A(e,3-ke(e)),t=q({y:n.y,m:1,d:1});return{year:n.y,week:Math.floor((q(n)-t)/7)+1}}function tt(e,n){return A(H({y:e,m:1,d:4},0),(n-1)*7)}var R=e=>Math.floor((e-1)/3)+1;function nt(e,n,t){let i=H({y:e,m:n,d:1},t);return Array.from({length:42},(l,o)=>A(i,o))}var I=e=>`${U(e.y,4)}-${U(e.m)}-${U(e.d)}`,Le=(e,n=!1)=>`${U(e.h)}:${U(e.mi)}${n?`:${U(e.s)}`:""}`,at=e=>`${U(e.y,4)}-${U(e.m)}`,rt=e=>`${U(e.y,4)}-Q${R(e.m)}`;function it(e){let n=de(e);return`${U(n.year,4)}-W${U(n.week)}`}function W(e){let n=/^(\d{4})-(\d{2})-(\d{2})/.exec(e.trim());if(!n)return null;let t={y:+n[1],m:+n[2],d:+n[3]};return t.m>=1&&t.m<=12&&t.d>=1&&t.d<=le(t.y,t.m)?t:null}function Ne(e){let n=/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(e.trim());if(!n)return null;let t={h:+n[1],mi:+n[2],s:+(n[3]??0)};return t.h<24&&t.mi<60&&t.s<60?t:null}var ue=["today","yesterday","last7","last30","thisWeek","lastWeek","thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","yearToDate"],X=(e,n,t)=>{let i={y:e,m:n,d:1},l=N(i,t-1);return[i,{y:l.y,m:l.m,d:le(l.y,l.m)}]};function ee(e,n,t){let i=H(n,t),l=(R(n.m)-1)*3+1;switch(e){case"today":return[n,n];case"yesterday":return[A(n,-1),A(n,-1)];case"last7":return[A(n,-6),n];case"last30":return[A(n,-29),n];case"thisWeek":return[i,A(i,6)];case"lastWeek":return[A(i,-7),A(i,-1)];case"thisMonth":return X(n.y,n.m,1);case"lastMonth":{let o=N({...n,d:1},-1);return X(o.y,o.m,1)}case"thisQuarter":return X(n.y,l,3);case"lastQuarter":{let o=N({y:n.y,m:l,d:1},-3);return X(o.y,o.m,3)}case"thisYear":return X(n.y,1,12);case"lastYear":return X(n.y-1,1,12);case"yearToDate":return[{y:n.y,m:1,d:1},n]}}var je=["today","now","clear","apply","cancel","from","to","time","week","quarter","previous","next","zone"],ot=["yesterday","last7","last30","thisWeek","lastWeek","thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","yearToDate"],Ct=["custom","compareTo","previousYear","previousPeriod","none"],Ce={en:"Today|Now|Clear|Apply|Cancel|From|To|Time|W|Q|Previous|Next|Time zone|Yesterday|Last 7 days|Last 30 days|This week|Last week|This month|Last month|This quarter|Last quarter|This year|Last year|Year to date|Custom|Compare to|Same period last year|Previous period|None",fr:"Aujourd'hui|Maintenant|Effacer|Appliquer|Annuler|Du|Au|Heure|S|T|Pr\xE9c\xE9dent|Suivant|Fuseau horaire|Hier|7 derniers jours|30 derniers jours|Cette semaine|Semaine derni\xE8re|Ce mois-ci|Mois dernier|Ce trimestre|Trimestre dernier|Cette ann\xE9e|Ann\xE9e derni\xE8re|Depuis le d\xE9but de l'ann\xE9e|Personnalis\xE9|Comparer \xE0|M\xEAme p\xE9riode N-1|P\xE9riode pr\xE9c\xE9dente|Aucune",de:"Heute|Jetzt|L\xF6schen|\xDCbernehmen|Abbrechen|Von|Bis|Uhrzeit|KW|Q|Zur\xFCck|Weiter|Zeitzone|Gestern|Letzte 7 Tage|Letzte 30 Tage|Diese Woche|Letzte Woche|Dieser Monat|Letzter Monat|Dieses Quartal|Letztes Quartal|Dieses Jahr|Letztes Jahr|Seit Jahresbeginn|Benutzerdefiniert|Vergleichen mit|Gleicher Zeitraum im Vorjahr|Vorheriger Zeitraum|Keiner",es:"Hoy|Ahora|Borrar|Aplicar|Cancelar|Desde|Hasta|Hora|S|T|Anterior|Siguiente|Zona horaria|Ayer|\xDAltimos 7 d\xEDas|\xDAltimos 30 d\xEDas|Esta semana|Semana pasada|Este mes|Mes pasado|Este trimestre|Trimestre pasado|Este a\xF1o|A\xF1o pasado|A\xF1o hasta la fecha|Personalizado|Comparar con|Mismo periodo del a\xF1o anterior|Periodo anterior|Ninguno",it:"Oggi|Adesso|Cancella|Applica|Annulla|Dal|Al|Ora|S|T|Precedente|Successivo|Fuso orario|Ieri|Ultimi 7 giorni|Ultimi 30 giorni|Questa settimana|Settimana scorsa|Questo mese|Mese scorso|Questo trimestre|Trimestre scorso|Quest'anno|Anno scorso|Da inizio anno|Personalizzato|Confronta con|Stesso periodo anno precedente|Periodo precedente|Nessuno",pt:"Hoje|Agora|Limpar|Aplicar|Cancelar|De|At\xE9|Hora|S|T|Anterior|Seguinte|Fuso hor\xE1rio|Ontem|\xDAltimos 7 dias|\xDAltimos 30 dias|Esta semana|Semana passada|Este m\xEAs|M\xEAs passado|Este trimestre|Trimestre passado|Este ano|Ano passado|Desde o in\xEDcio do ano|Personalizado|Comparar com|Mesmo per\xEDodo do ano anterior|Per\xEDodo anterior|Nenhum",nl:"Vandaag|Nu|Wissen|Toepassen|Annuleren|Van|Tot|Tijd|W|K|Vorige|Volgende|Tijdzone|Gisteren|Laatste 7 dagen|Laatste 30 dagen|Deze week|Vorige week|Deze maand|Vorige maand|Dit kwartaal|Vorig kwartaal|Dit jaar|Vorig jaar|Dit jaar tot nu|Aangepast|Vergelijken met|Zelfde periode vorig jaar|Vorige periode|Geen",sv:"Idag|Nu|Rensa|Anv\xE4nd|Avbryt|Fr\xE5n|Till|Tid|V|K|F\xF6reg\xE5ende|N\xE4sta|Tidszon|Ig\xE5r|Senaste 7 dagarna|Senaste 30 dagarna|Denna vecka|F\xF6rra veckan|Denna m\xE5nad|F\xF6rra m\xE5naden|Detta kvartal|F\xF6rra kvartalet|I \xE5r|F\xF6rra \xE5ret|Hittills i \xE5r|Anpassad|J\xE4mf\xF6r med|Samma period f\xF6reg\xE5ende \xE5r|F\xF6reg\xE5ende period|Ingen",da:"I dag|Nu|Ryd|Anvend|Annuller|Fra|Til|Tid|U|K|Forrige|N\xE6ste|Tidszone|I g\xE5r|Seneste 7 dage|Seneste 30 dage|Denne uge|Sidste uge|Denne m\xE5ned|Sidste m\xE5ned|Dette kvartal|Sidste kvartal|I \xE5r|Sidste \xE5r|\xC5r til dato|Tilpasset|Sammenlign med|Samme periode sidste \xE5r|Forrige periode|Ingen",nb:"I dag|N\xE5|T\xF8m|Bruk|Avbryt|Fra|Til|Tid|U|K|Forrige|Neste|Tidssone|I g\xE5r|Siste 7 dager|Siste 30 dager|Denne uken|Forrige uke|Denne m\xE5neden|Forrige m\xE5ned|Dette kvartalet|Forrige kvartal|I \xE5r|I fjor|Hittil i \xE5r|Egendefinert|Sammenlign med|Samme periode i fjor|Forrige periode|Ingen",fi:"T\xE4n\xE4\xE4n|Nyt|Tyhjenn\xE4|K\xE4yt\xE4|Peruuta|Alkaen|Asti|Aika|Vk|Q|Edellinen|Seuraava|Aikavy\xF6hyke|Eilen|Viimeiset 7 p\xE4iv\xE4\xE4|Viimeiset 30 p\xE4iv\xE4\xE4|T\xE4m\xE4 viikko|Viime viikko|T\xE4m\xE4 kuukausi|Viime kuukausi|T\xE4m\xE4 nelj\xE4nnes|Viime nelj\xE4nnes|T\xE4m\xE4 vuosi|Viime vuosi|Vuoden alusta|Mukautettu|Vertaa|Sama jakso viime vuonna|Edellinen jakso|Ei mit\xE4\xE4n",pl:"Dzisiaj|Teraz|Wyczy\u015B\u0107|Zastosuj|Anuluj|Od|Do|Godzina|Tydz.|Kw.|Poprzedni|Nast\u0119pny|Strefa czasowa|Wczoraj|Ostatnie 7 dni|Ostatnie 30 dni|Ten tydzie\u0144|Poprzedni tydzie\u0144|Ten miesi\u0105c|Poprzedni miesi\u0105c|Ten kwarta\u0142|Poprzedni kwarta\u0142|Ten rok|Poprzedni rok|Od pocz\u0105tku roku|Niestandardowy|Por\xF3wnaj z|Ten sam okres rok wcze\u015Bniej|Poprzedni okres|Brak",cs:"Dnes|Nyn\xED|Vymazat|Pou\u017E\xEDt|Zru\u0161it|Od|Do|\u010Cas|T|Q|P\u0159edchoz\xED|Dal\u0161\xED|\u010Casov\xE9 p\xE1smo|V\u010Dera|Posledn\xEDch 7 dn\xED|Posledn\xEDch 30 dn\xED|Tento t\xFDden|Minul\xFD t\xFDden|Tento m\u011Bs\xEDc|Minul\xFD m\u011Bs\xEDc|Toto \u010Dtvrtlet\xED|Minul\xE9 \u010Dtvrtlet\xED|Tento rok|Minul\xFD rok|Od za\u010D\xE1tku roku|Vlastn\xED|Porovnat s|Stejn\xE9 obdob\xED loni|P\u0159edchoz\xED obdob\xED|\u017D\xE1dn\xE9",sk:"Dnes|Teraz|Vymaza\u0165|Pou\u017Ei\u0165|Zru\u0161i\u0165|Od|Do|\u010Cas|T|Q|Predch\xE1dzaj\xFAci|\u010Eal\u0161\xED|\u010Casov\xE9 p\xE1smo|V\u010Dera|Posledn\xFDch 7 dn\xED|Posledn\xFDch 30 dn\xED|Tento t\xFD\u017Ede\u0148|Minul\xFD t\xFD\u017Ede\u0148|Tento mesiac|Minul\xFD mesiac|Tento \u0161tvr\u0165rok|Minul\xFD \u0161tvr\u0165rok|Tento rok|Minul\xFD rok|Od za\u010Diatku roka|Vlastn\xE9|Porovna\u0165 s|Rovnak\xE9 obdobie vlani|Predch\xE1dzaj\xFAce obdobie|\u017Diadne",hu:"Ma|Most|T\xF6rl\xE9s|Alkalmaz|M\xE9gse|Ett\u0151l|Eddig|Id\u0151|H|N|El\u0151z\u0151|K\xF6vetkez\u0151|Id\u0151z\xF3na|Tegnap|Elm\xFAlt 7 nap|Elm\xFAlt 30 nap|Ez a h\xE9t|M\xFAlt h\xE9t|Ez a h\xF3nap|M\xFAlt h\xF3nap|Ez a negyed\xE9v|M\xFAlt negyed\xE9v|Id\xE9n|Tavaly|\xC9v eleje \xF3ta|Egy\xE9ni|\xD6sszehasonl\xEDt\xE1s|El\u0151z\u0151 \xE9v azonos id\u0151szaka|El\u0151z\u0151 id\u0151szak|Nincs",ro:"Ast\u0103zi|Acum|\u0218terge|Aplic\u0103|Anuleaz\u0103|De la|P\xE2n\u0103 la|Ora|S|T|Anterior|Urm\u0103tor|Fus orar|Ieri|Ultimele 7 zile|Ultimele 30 de zile|S\u0103pt\u0103m\xE2na aceasta|S\u0103pt\u0103m\xE2na trecut\u0103|Luna aceasta|Luna trecut\u0103|Trimestrul acesta|Trimestrul trecut|Anul acesta|Anul trecut|De la \xEEnceputul anului|Personalizat|Compar\u0103 cu|Aceea\u0219i perioad\u0103 a anului trecut|Perioada anterioar\u0103|Niciuna",bg:"\u0414\u043D\u0435\u0441|\u0421\u0435\u0433\u0430|\u0418\u0437\u0447\u0438\u0441\u0442\u0438|\u041F\u0440\u0438\u043B\u043E\u0436\u0438|\u041E\u0442\u043A\u0430\u0437|\u041E\u0442|\u0414\u043E|\u0427\u0430\u0441|\u0421|\u0422\u0440|\u041F\u0440\u0435\u0434\u0438\u0448\u0435\u043D|\u0421\u043B\u0435\u0434\u0432\u0430\u0449|\u0427\u0430\u0441\u043E\u0432\u0430 \u0437\u043E\u043D\u0430|\u0412\u0447\u0435\u0440\u0430|\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0442\u0435 7 \u0434\u043D\u0438|\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0442\u0435 30 \u0434\u043D\u0438|\u0422\u0430\u0437\u0438 \u0441\u0435\u0434\u043C\u0438\u0446\u0430|\u041C\u0438\u043D\u0430\u043B\u0430\u0442\u0430 \u0441\u0435\u0434\u043C\u0438\u0446\u0430|\u0422\u043E\u0437\u0438 \u043C\u0435\u0441\u0435\u0446|\u041C\u0438\u043D\u0430\u043B\u0438\u044F \u043C\u0435\u0441\u0435\u0446|\u0422\u043E\u0432\u0430 \u0442\u0440\u0438\u043C\u0435\u0441\u0435\u0447\u0438\u0435|\u041C\u0438\u043D\u0430\u043B\u043E\u0442\u043E \u0442\u0440\u0438\u043C\u0435\u0441\u0435\u0447\u0438\u0435|\u0422\u0430\u0437\u0438 \u0433\u043E\u0434\u0438\u043D\u0430|\u041C\u0438\u043D\u0430\u043B\u0430\u0442\u0430 \u0433\u043E\u0434\u0438\u043D\u0430|\u041E\u0442 \u043D\u0430\u0447\u0430\u043B\u043E\u0442\u043E \u043D\u0430 \u0433\u043E\u0434\u0438\u043D\u0430\u0442\u0430|\u041F\u043E \u0438\u0437\u0431\u043E\u0440|\u0421\u0440\u0430\u0432\u043D\u0438 \u0441|\u0421\u044A\u0449\u0438\u044F\u0442 \u043F\u0435\u0440\u0438\u043E\u0434 \u043C\u0438\u043D\u0430\u043B\u0430\u0442\u0430 \u0433\u043E\u0434\u0438\u043D\u0430|\u041F\u0440\u0435\u0434\u0438\u0448\u0435\u043D \u043F\u0435\u0440\u0438\u043E\u0434|\u0411\u0435\u0437",el:"\u03A3\u03AE\u03BC\u03B5\u03C1\u03B1|\u03A4\u03CE\u03C1\u03B1|\u039A\u03B1\u03B8\u03B1\u03C1\u03B9\u03C3\u03BC\u03CC\u03C2|\u0395\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AE|\u0391\u03BA\u03CD\u03C1\u03C9\u03C3\u03B7|\u0391\u03C0\u03CC|\u0388\u03C9\u03C2|\u038F\u03C1\u03B1|\u0395\u03B2\u03B4|\u03A4\u03C1|\u03A0\u03C1\u03BF\u03B7\u03B3\u03BF\u03CD\u03BC\u03B5\u03BD\u03BF|\u0395\u03C0\u03CC\u03BC\u03B5\u03BD\u03BF|\u0396\u03CE\u03BD\u03B7 \u03CE\u03C1\u03B1\u03C2|\u03A7\u03B8\u03B5\u03C2|\u03A4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B5\u03C2 7 \u03B7\u03BC\u03AD\u03C1\u03B5\u03C2|\u03A4\u03B5\u03BB\u03B5\u03C5\u03C4\u03B1\u03AF\u03B5\u03C2 30 \u03B7\u03BC\u03AD\u03C1\u03B5\u03C2|\u0391\u03C5\u03C4\u03AE \u03C4\u03B7\u03BD \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1|\u03A0\u03C1\u03BF\u03B7\u03B3\u03BF\u03CD\u03BC\u03B5\u03BD\u03B7 \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1|\u0391\u03C5\u03C4\u03CC\u03BD \u03C4\u03BF\u03BD \u03BC\u03AE\u03BD\u03B1|\u03A0\u03C1\u03BF\u03B7\u03B3\u03BF\u03CD\u03BC\u03B5\u03BD\u03BF\u03C2 \u03BC\u03AE\u03BD\u03B1\u03C2|\u0391\u03C5\u03C4\u03CC \u03C4\u03BF \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF|\u03A0\u03C1\u03BF\u03B7\u03B3\u03BF\u03CD\u03BC\u03B5\u03BD\u03BF \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF|\u03A6\u03AD\u03C4\u03BF\u03C2|\u03A0\u03AD\u03C1\u03C3\u03B9|\u0391\u03C0\u03CC \u03C4\u03B7\u03BD \u03B1\u03C1\u03C7\u03AE \u03C4\u03BF\u03C5 \u03AD\u03C4\u03BF\u03C5\u03C2|\u03A0\u03C1\u03BF\u03C3\u03B1\u03C1\u03BC\u03BF\u03C3\u03BC\u03AD\u03BD\u03BF|\u03A3\u03CD\u03B3\u03BA\u03C1\u03B9\u03C3\u03B7 \u03BC\u03B5|\u038A\u03B4\u03B9\u03B1 \u03C0\u03B5\u03C1\u03AF\u03BF\u03B4\u03BF\u03C2 \u03C0\u03AD\u03C1\u03C3\u03B9|\u03A0\u03C1\u03BF\u03B7\u03B3\u03BF\u03CD\u03BC\u03B5\u03BD\u03B7 \u03C0\u03B5\u03C1\u03AF\u03BF\u03B4\u03BF\u03C2|\u039A\u03B1\u03BC\u03AF\u03B1",hr:"Danas|Sada|O\u010Disti|Primijeni|Odustani|Od|Do|Vrijeme|T|Kv|Prethodno|Sljede\u0107e|Vremenska zona|Ju\u010Der|Zadnjih 7 dana|Zadnjih 30 dana|Ovaj tjedan|Pro\u0161li tjedan|Ovaj mjesec|Pro\u0161li mjesec|Ovo tromjese\u010Dje|Pro\u0161lo tromjese\u010Dje|Ova godina|Pro\u0161la godina|Od po\u010Detka godine|Prilago\u0111eno|Usporedi s|Isto razdoblje pro\u0161le godine|Prethodno razdoblje|Ni\u0161ta",sl:"Danes|Zdaj|Po\u010Disti|Uporabi|Prekli\u010Di|Od|Do|\u010Cas|T|\u010C|Prej\u0161nji|Naslednji|\u010Casovni pas|V\u010Deraj|Zadnjih 7 dni|Zadnjih 30 dni|Ta teden|Prej\u0161nji teden|Ta mesec|Prej\u0161nji mesec|To \u010Detrtletje|Prej\u0161nje \u010Detrtletje|Letos|Lani|Od za\u010Detka leta|Po meri|Primerjaj z|Enako obdobje lani|Prej\u0161nje obdobje|Brez",uk:"\u0421\u044C\u043E\u0433\u043E\u0434\u043D\u0456|\u0417\u0430\u0440\u0430\u0437|\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u0438|\u0417\u0430\u0441\u0442\u043E\u0441\u0443\u0432\u0430\u0442\u0438|\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438|\u0412\u0456\u0434|\u0414\u043E|\u0427\u0430\u0441|\u0422\u0438\u0436|\u041A\u0432|\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439|\u041D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439|\u0427\u0430\u0441\u043E\u0432\u0438\u0439 \u043F\u043E\u044F\u0441|\u0412\u0447\u043E\u0440\u0430|\u041E\u0441\u0442\u0430\u043D\u043D\u0456 7 \u0434\u043D\u0456\u0432|\u041E\u0441\u0442\u0430\u043D\u043D\u0456 30 \u0434\u043D\u0456\u0432|\u0426\u0435\u0439 \u0442\u0438\u0436\u0434\u0435\u043D\u044C|\u041C\u0438\u043D\u0443\u043B\u0438\u0439 \u0442\u0438\u0436\u0434\u0435\u043D\u044C|\u0426\u0435\u0439 \u043C\u0456\u0441\u044F\u0446\u044C|\u041C\u0438\u043D\u0443\u043B\u0438\u0439 \u043C\u0456\u0441\u044F\u0446\u044C|\u0426\u0435\u0439 \u043A\u0432\u0430\u0440\u0442\u0430\u043B|\u041C\u0438\u043D\u0443\u043B\u0438\u0439 \u043A\u0432\u0430\u0440\u0442\u0430\u043B|\u0426\u0435\u0439 \u0440\u0456\u043A|\u041C\u0438\u043D\u0443\u043B\u0438\u0439 \u0440\u0456\u043A|\u0417 \u043F\u043E\u0447\u0430\u0442\u043A\u0443 \u0440\u043E\u043A\u0443|\u0412\u043B\u0430\u0441\u043D\u0438\u0439|\u041F\u043E\u0440\u0456\u0432\u043D\u044F\u0442\u0438 \u0437|\u0422\u043E\u0439 \u0441\u0430\u043C\u0438\u0439 \u043F\u0435\u0440\u0456\u043E\u0434 \u0442\u043E\u0440\u0456\u043A|\u041F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439 \u043F\u0435\u0440\u0456\u043E\u0434|\u041D\u0435\u043C\u0430\u0454",ru:"\u0421\u0435\u0433\u043E\u0434\u043D\u044F|\u0421\u0435\u0439\u0447\u0430\u0441|\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C|\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C|\u041E\u0442\u043C\u0435\u043D\u0430|\u0421|\u041F\u043E|\u0412\u0440\u0435\u043C\u044F|\u041D\u0435\u0434|\u041A\u0432|\u041D\u0430\u0437\u0430\u0434|\u0412\u043F\u0435\u0440\u0451\u0434|\u0427\u0430\u0441\u043E\u0432\u043E\u0439 \u043F\u043E\u044F\u0441|\u0412\u0447\u0435\u0440\u0430|\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 7 \u0434\u043D\u0435\u0439|\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 30 \u0434\u043D\u0435\u0439|\u042D\u0442\u0430 \u043D\u0435\u0434\u0435\u043B\u044F|\u041F\u0440\u043E\u0448\u043B\u0430\u044F \u043D\u0435\u0434\u0435\u043B\u044F|\u042D\u0442\u043E\u0442 \u043C\u0435\u0441\u044F\u0446|\u041F\u0440\u043E\u0448\u043B\u044B\u0439 \u043C\u0435\u0441\u044F\u0446|\u042D\u0442\u043E\u0442 \u043A\u0432\u0430\u0440\u0442\u0430\u043B|\u041F\u0440\u043E\u0448\u043B\u044B\u0439 \u043A\u0432\u0430\u0440\u0442\u0430\u043B|\u042D\u0442\u043E\u0442 \u0433\u043E\u0434|\u041F\u0440\u043E\u0448\u043B\u044B\u0439 \u0433\u043E\u0434|\u0421 \u043D\u0430\u0447\u0430\u043B\u0430 \u0433\u043E\u0434\u0430|\u0421\u0432\u043E\u0439|\u0421\u0440\u0430\u0432\u043D\u0438\u0442\u044C \u0441|\u0422\u043E\u0442 \u0436\u0435 \u043F\u0435\u0440\u0438\u043E\u0434 \u0433\u043E\u0434 \u043D\u0430\u0437\u0430\u0434|\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u043F\u0435\u0440\u0438\u043E\u0434|\u041D\u0435\u0442",tr:"Bug\xFCn|\u015Eimdi|Temizle|Uygula|\u0130ptal|Ba\u015Flang\u0131\xE7|Biti\u015F|Saat|H|\xC7|\xD6nceki|Sonraki|Saat dilimi|D\xFCn|Son 7 g\xFCn|Son 30 g\xFCn|Bu hafta|Ge\xE7en hafta|Bu ay|Ge\xE7en ay|Bu \xE7eyrek|Ge\xE7en \xE7eyrek|Bu y\u0131l|Ge\xE7en y\u0131l|Y\u0131l ba\u015F\u0131ndan bug\xFCne|\xD6zel|Kar\u015F\u0131la\u015Ft\u0131r|Ge\xE7en y\u0131l\u0131n ayn\u0131 d\xF6nemi|\xD6nceki d\xF6nem|Yok",ca:"Avui|Ara|Esborra|Aplica|Cancel\xB7la|Des de|Fins a|Hora|S|T|Anterior|Seg\xFCent|Fus horari|Ahir|\xDAltims 7 dies|\xDAltims 30 dies|Aquesta setmana|Setmana passada|Aquest mes|Mes passat|Aquest trimestre|Trimestre passat|Aquest any|Any passat|Des de l'inici de l'any|Personalitzat|Compara amb|Mateix per\xEDode de l'any anterior|Per\xEDode anterior|Cap",lt:"\u0160iandien|Dabar|I\u0161valyti|Taikyti|At\u0161aukti|Nuo|Iki|Laikas|Sav|Ketv|Ankstesnis|Kitas|Laiko juosta|Vakar|Paskutin\u0117s 7 dienos|Paskutin\u0117s 30 dien\u0173|\u0160i savait\u0117|Pra\u0117jusi savait\u0117|\u0160is m\u0117nuo|Pra\u0117j\u0119s m\u0117nuo|\u0160is ketvirtis|Pra\u0117j\u0119s ketvirtis|\u0160ie metai|Pra\u0117j\u0119 metai|Nuo met\u0173 prad\u017Eios|Pasirinktinis|Palyginti su|Tas pats laikotarpis pernai|Ankstesnis laikotarpis|N\u0117ra",lv:"\u0160odien|Tagad|Not\u012Br\u012Bt|Lietot|Atcelt|No|L\u012Bdz|Laiks|Ned|Cet|Iepriek\u0161\u0113jais|N\u0101kamais|Laika josla|Vakar|P\u0113d\u0113j\u0101s 7 dienas|P\u0113d\u0113j\u0101s 30 dienas|\u0160\u012B ned\u0113\u013Ca|Pag\u0101ju\u0161\u0101 ned\u0113\u013Ca|\u0160is m\u0113nesis|Pag\u0101ju\u0161ais m\u0113nesis|\u0160is ceturksnis|Pag\u0101ju\u0161ais ceturksnis|\u0160is gads|Pag\u0101ju\u0161ais gads|Kop\u0161 gada s\u0101kuma|Piel\u0101gots|Sal\u012Bdzin\u0101t ar|Tas pats periods p\u0113rn|Iepriek\u0161\u0113jais periods|Nav",et:"T\xE4na|Praegu|T\xFChjenda|Rakenda|T\xFChista|Alates|Kuni|Aeg|N\xE4d|Kv|Eelmine|J\xE4rgmine|Ajav\xF6\xF6nd|Eile|Viimased 7 p\xE4eva|Viimased 30 p\xE4eva|See n\xE4dal|Eelmine n\xE4dal|See kuu|Eelmine kuu|See kvartal|Eelmine kvartal|See aasta|Eelmine aasta|Aasta algusest|Kohandatud|V\xF5rdle|Sama periood eelmisel aastal|Eelmine periood|Puudub",ar:"\u0627\u0644\u064A\u0648\u0645|\u0627\u0644\u0622\u0646|\u0645\u0633\u062D|\u062A\u0637\u0628\u064A\u0642|\u0625\u0644\u063A\u0627\u0621|\u0645\u0646|\u0625\u0644\u0649|\u0627\u0644\u0648\u0642\u062A|\u0623|\u0631|\u0627\u0644\u0633\u0627\u0628\u0642|\u0627\u0644\u062A\u0627\u0644\u064A|\u0627\u0644\u0645\u0646\u0637\u0642\u0629 \u0627\u0644\u0632\u0645\u0646\u064A\u0629|\u0623\u0645\u0633|\u0622\u062E\u0631 7 \u0623\u064A\u0627\u0645|\u0622\u062E\u0631 30 \u064A\u0648\u0645\u064B\u0627|\u0647\u0630\u0627 \u0627\u0644\u0623\u0633\u0628\u0648\u0639|\u0627\u0644\u0623\u0633\u0628\u0648\u0639 \u0627\u0644\u0645\u0627\u0636\u064A|\u0647\u0630\u0627 \u0627\u0644\u0634\u0647\u0631|\u0627\u0644\u0634\u0647\u0631 \u0627\u0644\u0645\u0627\u0636\u064A|\u0647\u0630\u0627 \u0627\u0644\u0631\u0628\u0639|\u0627\u0644\u0631\u0628\u0639 \u0627\u0644\u0645\u0627\u0636\u064A|\u0647\u0630\u0647 \u0627\u0644\u0633\u0646\u0629|\u0627\u0644\u0633\u0646\u0629 \u0627\u0644\u0645\u0627\u0636\u064A\u0629|\u0645\u0646\u0630 \u0628\u062F\u0627\u064A\u0629 \u0627\u0644\u0633\u0646\u0629|\u0645\u062E\u0635\u0635|\u0645\u0642\u0627\u0631\u0646\u0629 \u0645\u0639|\u0627\u0644\u0641\u062A\u0631\u0629 \u0646\u0641\u0633\u0647\u0627 \u0645\u0646 \u0627\u0644\u0633\u0646\u0629 \u0627\u0644\u0645\u0627\u0636\u064A\u0629|\u0627\u0644\u0641\u062A\u0631\u0629 \u0627\u0644\u0633\u0627\u0628\u0642\u0629|\u0628\u062F\u0648\u0646"},Ie=Object.keys(Ce),st=e=>e.toLowerCase().split(/[-_]/)[0];function ce(e,n={}){let t=st(e),i=(Ce[t==="no"?"nb":t]??Ce.en).split("|"),l={periods:{}};je.forEach((m,T)=>l[m]=i[T]),l.periods.today=l.today,ot.forEach((m,T)=>l.periods[m]=i[je.length+T]),Ct.forEach((m,T)=>l[m]=i[je.length+ot.length+T]);let{periods:o,...d}=n;return{...l,...d,periods:{...l.periods,...o}}}function lt(e){try{let n=new Intl.Locale(e),t=n.getTextInfo?.()??n.textInfo;if(t)return t.direction==="rtl"}catch{}return["ar","fa","ur","ps","dv","ckb"].includes(st(e))}function dt(e){try{let n=new Intl.Locale(e),t=n.getWeekInfo?.()??n.weekInfo;if(t)return(t.firstDay+6)%7;let i=n.maximize().region??"";if(["US","CA","MX","BR","JP","KR","IL","IN","PH","SA","ZA","CO","PE","VE"].includes(i))return 6;if(["EG","DZ","MA","TN","IQ","SY","JO","KW","QA","BH","OM","LY","AF","IR"].includes(i))return i==="MA"||i==="TN"?0:5}catch{}return 0}function ut(e){try{return new Intl.DateTimeFormat(e,{hour:"numeric"}).resolvedOptions().hour12===!0}catch{return!1}}var ct=(e,n,t)=>new Date(Date.UTC(e,n-1,t,12));function xe(e,n="long"){let t=new Intl.DateTimeFormat(e,{month:n,timeZone:"UTC"});return Array.from({length:12},(i,l)=>t.format(ct(2024,l+1,15)))}function Oe(e,n,t="short"){let i=new Intl.DateTimeFormat(e,{weekday:t,timeZone:"UTC"});return Array.from({length:7},(l,o)=>i.format(ct(2024,1,1+(n+o)%7)))}var mt=(e,n,t=1)=>new Intl.NumberFormat(n,{useGrouping:!1,minimumIntegerDigits:t}).format(e);var pt=new Map,It=()=>new Intl.DateTimeFormat().resolvedOptions().timeZone,Pe=e=>!e||e==="local"?It():e.toUpperCase()==="UTC"?"UTC":e;function Ve(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function Ot(e){let n=pt.get(e);return n||(n=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),pt.set(e,n)),n}function te(e,n){let t={};for(let i of Ot(n).formatToParts(e))i.type!=="literal"&&(t[i.type]=Number(i.value));return{y:t.year,m:t.month,d:t.day,h:t.hour%24,mi:t.minute,s:t.second}}function me(e,n){let t=te(e,n);return Math.round((Date.UTC(t.y,t.m-1,t.d,t.h,t.mi,t.s)-Math.floor(e/1e3)*1e3)/6e4)}function ne(e,n,t){let i=Date.UTC(e.y,e.m-1,e.d,n.h,n.mi,n.s),l=i-me(i,t)*6e4,o=i-me(l,t)*6e4,d=me(o-3*36e5,t),m=i-d*6e4;return m<o&&me(m,t)===d?m:o}function $e(e,n=Date.now()){let t=te(n,e);return{y:t.y,m:t.m,d:t.d}}function ft(e,n){let t=me(e,n);if(n==="UTC"||t===0)return n==="UTC"?"Z":"+00:00";let i=Math.abs(t);return`${t<0?"-":"+"}${String(Math.floor(i/60)).padStart(2,"0")}:${String(i%60).padStart(2,"0")}`}function Fe(e,n,t){try{return new Intl.DateTimeFormat(t,{timeZone:n,timeZoneName:"shortOffset"}).formatToParts(e).find(l=>l.type==="timeZoneName")?.value??n}catch{return n}}var L={h:0,mi:0,s:0},re=()=>({dates:[],times:[L,L]}),we=(e,n)=>n==="range"?e.dates.length===2:e.dates.length>0;function ae(e,n){if(e instanceof Date){if(Number.isNaN(e.getTime()))return null;let d=te(e.getTime(),n);return{date:{y:d.y,m:d.m,d:d.d},time:{h:d.h,mi:d.mi,s:d.s}}}let t=e.trim(),i=W(t);if(!i)return null;let l=t.slice(10);if(!l)return{date:i,time:null};if(/(Z|[+-]\d{2}:?\d{2})$/i.test(l)){let d=Date.parse(t);return Number.isNaN(d)?null:ae(new Date(d),n)}let o=Ne(l.replace(/^[T ]/,"").replace(/\.\d+$/,""));return o?{date:i,time:o}:null}function Te(e,n){let t=re();if(e==null||e==="")return t;let{mode:i,zone:l}=n;if(i==="multiple"){let m=Array.isArray(e)?e:[e];for(let T of m){let a=typeof T=="string"||T instanceof Date?ae(T,l):null;a&&!t.dates.some($=>j($,a.date)===0)&&t.dates.push(a.date)}return t.dates.sort(j),t}if(i==="range"){let m=Array.isArray(e)?e:typeof e=="object"&&!(e instanceof Date)?[e.start,e.end]:[],T=m[0]?ae(m[0],l):null,a=m[1]?ae(m[1],l):null;if(T&&a){let[$,p]=j(T.date,a.date)<=0?[T,a]:[a,T];t.dates=[$.date,p.date],t.times=[$.time??L,p.time??L]}return t}if(e instanceof Date||typeof e!="string"){let m=e instanceof Date?ae(e,l):null;return m&&(t.dates=[m.date],t.times=[m.time??L,L]),t}let o=e.trim(),d;if(i==="time"){let m=Ne(o);m&&(t.dates=[{y:1970,m:1,d:1}],t.times=[m,L])}else if(i==="week"&&(d=/^(\d{4})-W(\d{1,2})$/i.exec(o)))t.dates=[tt(+d[1],+d[2])];else if(i==="month"&&(d=/^(\d{4})-(\d{2})$/.exec(o))&&+d[2]>=1&&+d[2]<=12)t.dates=[{y:+d[1],m:+d[2],d:1}];else if(i==="quarter"&&(d=/^(\d{4})-Q([1-4])$/i.exec(o)))t.dates=[{y:+d[1],m:(+d[2]-1)*3+1,d:1}];else if(i==="year"&&(d=/^(\d{4})$/.exec(o)))t.dates=[{y:+d[1],m:1,d:1}];else{let m=ae(o,l);m&&(t.dates=[m.date],t.times=[m.time??L,L])}return t}function Ue(e,n,t){return t.time?`${I(e)}T${Le(n,t.seconds)}${ft(ne(e,n,t.zone),t.zone)}`:I(e)}function pe(e,n){let[t,i]=e.dates;if(n.mode==="multiple")return e.dates.map(I);if(!t)return null;switch(n.mode){case"range":return i?{start:Ue(t,e.times[0],n),end:Ue(i,e.times[1],n)}:null;case"week":return it(t);case"month":return at(t);case"quarter":return rt(t);case"year":return String(t.y).padStart(4,"0");case"time":return Le(e.times[0],n.seconds);default:return Ue(t,e.times[0],n)}}function Vt(e,n){let[t,i]=e.dates,{mode:l,zone:o}=n;if(!t||l==="time"||l==="multiple"||l==="range"&&!i)return[null,null];let d=(m,T=L)=>new Date(ne(m,T,o));switch(l){case"range":return n.time?[d(t,e.times[0]),d(i,e.times[1])]:[d(t),d(A(i,1))];case"week":{let m=H(t,0);return[d(m),d(A(m,7))]}case"month":return[d({...t,d:1}),d(N({...t,d:1},1))];case"quarter":{let m={y:t.y,m:(R(t.m)-1)*3+1,d:1};return[d(m),d(N(m,3))]}case"year":return[d({y:t.y,m:1,d:1}),d({y:t.y+1,m:1,d:1})];default:return n.time?[d(t,e.times[0]),d(t,e.times[0])]:[d(t),d(A(t,1))]}}var ht=e=>new Date(Date.UTC(e.y,e.m-1,e.d,12));function De(e,n,t,i){if(!t.time)return new Intl.DateTimeFormat(t.locale,{...i??{dateStyle:"medium"},timeZone:"UTC"}).format(ht(e));let l=i??{dateStyle:"medium",timeStyle:t.seconds?"medium":"short"};return new Intl.DateTimeFormat(t.locale,{...l,hour12:t.hour12,timeZone:t.zone}).format(ne(e,n,t.zone))}function $t(e,n,t,i){let[l,o]=e.dates;if(!l)return"";let{locale:d}=n;switch(n.mode){case"multiple":return e.dates.map(m=>De(m,L,{...n,time:!1},i)).join(", ");case"range":return o?`${De(l,e.times[0],n,i)} \u2013 ${De(o,e.times[1],n,i)}`:"";case"week":{let m=de(l);return`${t.week}${m.week} ${m.year}`}case"month":return new Intl.DateTimeFormat(d,{...i??{month:"long",year:"numeric"},timeZone:"UTC"}).format(ht(l));case"quarter":return`${t.quarter}${R(l.m)} ${l.y}`;case"year":return String(l.y);case"time":{let m=e.times[0];return new Intl.DateTimeFormat(d,{...i??{timeStyle:n.seconds?"medium":"short"},hour12:n.hour12,timeZone:"UTC"}).format(Date.UTC(1970,0,1,m.h,m.mi,m.s))}default:return De(l,e.times[0],n,i)}}function gt(e,n,t,i){let[l,o]=Vt(e,n),d={mode:n.mode,value:pe(e,n),start:l,end:o,zone:n.zone,text:$t(e,n,t,typeof i=="object"?i:void 0)};return typeof i=="function"&&we(e,n.mode)?{...d,text:i(d)}:d}var vt=(e,n)=>({y:e,m:n,d:le(e,n)}),Ft={day:"date",week:"week",month:"month",quarter:"quarter",year:"year",custom:"range"},yt=e=>Ft[e];function He(e,n){let[t,i]=e.dates;if(!t||n==="range"&&!i)return null;switch(n){case"range":return[t,i];case"week":{let l=H(t,0);return[l,A(l,6)]}case"month":return[{...t,d:1},vt(t.y,t.m)];case"quarter":{let l=(R(t.m)-1)*3+1;return[{y:t.y,m:l,d:1},vt(t.y,l+2)]}case"year":return[{y:t.y,m:1,d:1},{y:t.y,m:12,d:31}];default:return[t,t]}}function bt(e,n){if(j(e,n)===0)return"day";let t=i=>e.d===1&&j(n,A(N({...e,d:1},i),-1))===0;return e.m===1&&t(12)?"year":(e.m-1)%3===0&&t(3)?"quarter":t(1)?"month":j(e,H(e,0))===0&&q(n)-q(e)===6?"week":"custom"}function kt(e,n,t){if(t==="previousYear")return[N(e,-12),N(n,-12)];if(t==="previousPeriod"){let i=q(n)-q(e)+1;return[A(e,-i),A(e,-1)]}return null}var fe=`
3
+ .nv-dt{--nv-dt-accent:#e04f39;--nv-dt-accent-ink:#fff;--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-range:color-mix(in srgb,var(--nv-dt-accent) 14%,transparent);--nv-dt-radius:10px;--nv-dt-cell:36px;--nv-dt-font:inherit;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14);box-sizing:border-box;display:inline-flex;max-width:100%;font-family:var(--nv-dt-font);font-size:14px;line-height:1.3;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:var(--nv-dt-radius);user-select:none;-webkit-user-select:none}
4
+ .nv-dt *,.nv-dt *::before{box-sizing:border-box}
5
+ .nv-dt[data-theme=dark]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}
6
+ @media (prefers-color-scheme:dark){.nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}}
7
+ :root.dark .nv-dt[data-theme=auto],:root[data-theme=dark] .nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}
8
+ :root:not(.dark)[data-theme=light] .nv-dt[data-theme=auto]{--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14)}
9
+ .nv-dt-pop{position:absolute;z-index:1000;box-shadow:var(--nv-dt-shadow)}
10
+ .nv-dt[hidden]{display:none}
11
+ .nv-dt button{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;border-radius:calc(var(--nv-dt-radius) - 4px)}
12
+ .nv-dt button:focus-visible,.nv-dt input:focus-visible,.nv-dt select:focus-visible{outline:2px solid var(--nv-dt-accent);outline-offset:1px}
13
+ .nv-dt button:disabled{cursor:default;opacity:.35}
14
+ .nv-dt-presets{display:flex;flex-direction:column;gap:2px;padding:10px 8px;border-inline-end:1px solid var(--nv-dt-line);min-width:150px}
15
+ .nv-dt-presets button{text-align:start;padding:7px 10px;white-space:nowrap}
16
+ .nv-dt-presets button:hover{background:var(--nv-dt-hover)}
17
+ .nv-dt-presets button[aria-pressed=true]{background:var(--nv-dt-range);color:var(--nv-dt-accent);font-weight:600}
18
+ .nv-dt-vertical{flex-direction:column}
19
+ .nv-dt-vertical .nv-dt-presets{flex-direction:row;flex-wrap:wrap;border-inline-end:0;border-bottom:1px solid var(--nv-dt-line);min-width:0}
20
+ .nv-dt-vertical .nv-dt-months{flex-direction:column}
21
+ .nv-dt-tabs{display:flex;flex-wrap:wrap;gap:2px;padding:3px;background:var(--nv-dt-hover);border-radius:var(--nv-dt-radius)}
22
+ .nv-dt-tabs button{flex:1;padding:6px 10px;white-space:nowrap;text-transform:capitalize;color:var(--nv-dt-muted)}
23
+ .nv-dt-tabs button:hover{color:var(--nv-dt-ink)}
24
+ .nv-dt-tabs button[aria-selected=true]{background:var(--nv-dt-bg);color:var(--nv-dt-ink);font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,.14)}
25
+ .nv-dt-main{display:flex;flex-direction:column;gap:10px;padding:12px;min-width:0}
26
+ .nv-dt-months{display:flex;gap:18px;flex-wrap:wrap}
27
+ .nv-dt-month{display:flex;flex-direction:column;gap:6px}
28
+ .nv-dt-head{display:flex;align-items:center;gap:4px;min-height:32px}
29
+ .nv-dt-title{flex:1;display:flex;justify-content:center;gap:2px;font-weight:600}
30
+ .nv-dt-title button{padding:5px 8px;text-transform:capitalize}
31
+ .nv-dt-title button:hover,.nv-dt-nav:hover{background:var(--nv-dt-hover)}
32
+ .nv-dt-nav{width:32px;height:32px;display:grid;place-items:center;flex:none}
33
+ .nv-dt-nav svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
34
+ .nv-dt[dir=rtl] .nv-dt-nav svg{transform:scaleX(-1)}
35
+ .nv-dt-nav[data-hide]{visibility:hidden}
36
+ .nv-dt-grid{display:grid;grid-template-columns:repeat(7,var(--nv-dt-cell));row-gap:2px}
37
+ .nv-dt-grid[data-weeks]{grid-template-columns:28px repeat(7,var(--nv-dt-cell))}
38
+ .nv-dt-dow,.nv-dt-wk{display:grid;place-items:center;height:28px;font-size:12px;color:var(--nv-dt-muted);text-transform:capitalize}
39
+ .nv-dt-wk{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums}
40
+ .nv-dt-day{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums;position:relative}
41
+ .nv-dt-day:hover:not(:disabled){background:var(--nv-dt-hover)}
42
+ .nv-dt-day.is-out{color:var(--nv-dt-muted);opacity:.55}
43
+ .nv-dt-day.is-today::after{content:"";position:absolute;inset-inline:0;bottom:5px;margin:auto;width:4px;height:4px;border-radius:50%;background:var(--nv-dt-accent)}
44
+ .nv-dt-day.is-in{background:var(--nv-dt-range);border-radius:0}
45
+ .nv-dt-day.is-start,.nv-dt-day.is-end,.nv-dt-day.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink);opacity:1}
46
+ .nv-dt-day.is-start:hover,.nv-dt-day.is-end:hover,.nv-dt-day.is-on:hover{background:var(--nv-dt-accent)}
47
+ .nv-dt-day.is-start.is-in{border-start-end-radius:0;border-end-end-radius:0}
48
+ .nv-dt-day.is-end.is-in{border-start-start-radius:0;border-end-start-radius:0}
49
+ .nv-dt-day.is-on.is-today::after,.nv-dt-day.is-start.is-today::after,.nv-dt-day.is-end.is-today::after{background:var(--nv-dt-accent-ink)}
50
+ .nv-dt-day:disabled{text-decoration:line-through}
51
+ .nv-dt-cells{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;min-width:calc(var(--nv-dt-cell) * 7)}
52
+ .nv-dt-cells[data-view=quarters]{grid-template-columns:repeat(2,1fr)}
53
+ .nv-dt-cell{padding:14px 6px;text-transform:capitalize;font-variant-numeric:tabular-nums}
54
+ .nv-dt-cell small{display:block;font-size:11px;color:var(--nv-dt-muted);margin-top:2px;text-transform:none}
55
+ .nv-dt-cell:hover:not(:disabled){background:var(--nv-dt-hover)}
56
+ .nv-dt-cell.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}
57
+ .nv-dt-cell.is-on small{color:inherit;opacity:.85}
58
+ .nv-dt-cell.is-now{box-shadow:inset 0 0 0 1px var(--nv-dt-accent)}
59
+ .nv-dt-times{display:flex;flex-wrap:wrap;gap:8px 18px;padding-top:10px;border-top:1px solid var(--nv-dt-line)}
60
+ .nv-dt-time{display:flex;align-items:center;gap:4px}
61
+ .nv-dt-time>span:first-child{color:var(--nv-dt-muted);font-size:12px;margin-inline-end:4px}
62
+ .nv-dt-time input{width:46px;height:32px;text-align:center;font:inherit;font-variant-numeric:tabular-nums;color:inherit;background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0;user-select:text;-webkit-user-select:text}
63
+ .nv-dt-time button{height:32px;padding:0 8px;border:1px solid var(--nv-dt-line)}
64
+ .nv-dt-zone{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--nv-dt-muted)}
65
+ .nv-dt-zone select{flex:1;min-width:0;height:30px;font:inherit;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0 6px}
66
+ .nv-dt-foot{display:flex;gap:6px;justify-content:space-between;padding-top:10px;border-top:1px solid var(--nv-dt-line)}
67
+ .nv-dt-foot div{display:flex;gap:6px}
68
+ .nv-dt-foot button{padding:6px 10px}
69
+ .nv-dt-foot button:hover{background:var(--nv-dt-hover)}
70
+ .nv-dt-foot .nv-dt-apply{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}
71
+ .nv-dt-foot .nv-dt-apply:hover{background:var(--nv-dt-accent);filter:brightness(1.08)}
72
+ @media (max-width:520px){.nv-dt{flex-direction:column}.nv-dt-presets{flex-direction:row;flex-wrap:wrap;border-inline-end:0;border-bottom:1px solid var(--nv-dt-line);min-width:0}.nv-dt{--nv-dt-cell:clamp(30px,calc((100vw - 60px)/7),36px)}}
73
+ @media (prefers-reduced-motion:no-preference){.nv-dt-day,.nv-dt-cell,.nv-dt button{transition:background-color .12s,color .12s}}
74
+ `;var xt="nv-datetime-style",Pt=new WeakSet;function Re(e=globalThis.document){if(!e||Pt.has(e))return;let n=e.nodeType===9,t=n?e:e.ownerDocument;if(!t||(Pt.add(e),e.querySelector(`#${xt}`)))return;let i=t.createElement("style");i.id=xt,i.textContent=fe,(n?e.head??e.documentElement:e).append(i)}var G=e=>e==="month"?"months":e==="quarter"?"quarters":e==="year"?"years":"days",qe=["day","week","month","quarter","year","custom"],Ut={today:"day",yesterday:"day",thisWeek:"week",lastWeek:"week",thisMonth:"month",lastMonth:"month",thisQuarter:"quarter",lastQuarter:"quarter",thisYear:"year",lastYear:"year"},Dt=e=>e===!0?"previousYear":typeof e=="string"?e:"none";function Ee(e,n,t,i){let l=e.mode==="period",o=l?yt(i):e.mode??"date",d=(e.granularities??qe).filter(z=>qe.includes(z)),m=e.presets??l,T=[e.locale,n.documentElement.lang,globalThis.navigator?.language].find(Boolean)??"en",a=!l&&(o==="time"||!!e.time&&(o==="date"||o==="range")),$=Pe(e.zone),p=e.hour12??ut(T);return{shape:{mode:o,time:a,seconds:!!e.seconds,zone:Ve($)?$:"UTC",locale:T,hour12:p},labels:ce(T,e.labels),rtl:lt(T),firstDay:o==="week"?0:((e.firstDay??dt(T))%7+7)%7,min:e.min?W(e.min):null,max:e.max?W(e.max):null,months:Math.min(3,Math.max(1,e.months??(o==="range"?2:1))),weekNumbers:e.weekNumbers??o==="week",presets:o!=="range"&&!l||!m?[]:m===!0?ue:m,inline:e.inline??!t,autoClose:e.autoClose??(!a&&!l),period:l,granularities:d.length?d:qe,hour12:p,minuteStep:Math.max(1,Math.floor(e.minuteStep??1)),zones:(e.zones??[]).map(Pe).filter(Ve)}}function Se(e,n={}){let t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error(`@nervure/datetime: no element for ${typeof e=="string"?e:"the target"}`);let i=t.ownerDocument,l=t.getRootNode(),o=t instanceof i.defaultView.HTMLInputElement?t:null;Re(l.nodeType===9||l.nodeType===11?l:i);let d={...n},m="month",T=Dt(d.compare),a=Ee(d,i,!!o,m);function $(r){if(d.mode!=="period")return Te(r,a.shape);let s=a.granularities,u=s.includes("custom")?"custom":s[0],v=Te(r,{...a.shape,mode:"range",time:!1}),[h,g]=v.dates;if(h&&g){let D=bt(h,g);m=s.includes(D)?D:u}else m=d.granularity&&s.includes(d.granularity)?d.granularity:s.includes("month")?"month":s[0];return a=Ee(d,i,!!o,m),!h||!g?re():m==="custom"?v:{dates:[h],times:[L,L]}}let p=$(d.value),z=G(a.shape.mode),S=p.dates[0]??$e(a.shape.zone),M={...S,d:1},Z=null,F=!1,Y=null,P=i.createElement("div");P.className="nv-dt";let b=(r,s={},...u)=>{let v=i.createElement(r);for(let[h,g]of Object.entries(s))if(g!=null)if(h.startsWith("aria-"))v.setAttribute(h,String(g));else{if(g===!1)continue;h==="class"?v.className=String(g):v.setAttribute(h,g===!0?"":String(g))}return v.append(...u),v},K=(r,s=1)=>mt(r,a.shape.locale,s),O=()=>$e(a.shape.zone);function Ae(r){if(a.min&&j(r,a.min)<0||a.max&&j(r,a.max)>0)return!0;let s=d.disable;if(!s)return!1;let u=I(r);return typeof s=="function"?s(u,ke(r)):s.includes(u)}function wt(r,s){return a.max&&j(r,a.max)>0?!0:!!a.min&&j(s,a.min)<0}function ie(){let r=gt(p,a.shape,a.labels,d.format);if(!a.period)return r;let s=He(p,a.shape.mode),u=s?kt(s[0],s[1],T):null,v=h=>new Date(ne(h,L,a.shape.zone));return{...r,mode:"period",value:s?{start:I(s[0]),end:I(s[1])}:null,granularity:m,compare:u?{with:T,start:v(u[0]),end:v(A(u[1],1)),value:{start:I(u[0]),end:I(u[1])}}:null}}function Ge(r,s=He(p,a.shape.mode),u=!0){m=a.granularities.includes(r)?r:a.granularities.includes("custom")?"custom":a.granularities[0],a=Ee(d,i,!!o,m),p=s?m==="custom"?{dates:[s[0],s[1]],times:[L,L]}:{dates:[s[0]],times:[L,L]}:re(),Z=null,S=p.dates[0]??O(),M={...S,d:1},z=G(a.shape.mode),C(!0),ge(),V(u&&!!s)}function V(r){let s=ie();o&&(o.value=s.text,Y&&(Y.value=s.value===null?"":typeof s.value=="string"?s.value:JSON.stringify(s.value))),r&&(d.onChange?.(s),t.dispatchEvent(new CustomEvent("nv-change",{detail:s,bubbles:!0,composed:!0})))}function oe(){V(!0),a.autoClose&&we(p,a.shape.mode)&&a.shape.mode!=="multiple"&&_()}function Ze(r){if(Ae(r))return;S=r;let{mode:s}=a.shape;if(s==="multiple"){let u=p.dates.findIndex(v=>B(v,r));u>=0?p.dates.splice(u,1):p.dates=[...p.dates,r].sort(j)}else if(s==="range"){let[u,v]=p.dates;!u||v?p.dates=[r]:p.dates=j(r,u)<0?[r,u]:[u,r],Z=null}else p.dates=[r];C(),s!=="range"||p.dates.length===2?oe():V(!1)}function Ye(r){if(S=r,M={...r,d:1},z===G(a.shape.mode)){p.dates=[r],C(),oe();return}z=G(a.shape.mode),C()}function Tt(r){let s,u;if(typeof r=="string")[s,u]=ee(r,O(),a.firstDay);else{let[v,h]=r.range(I(O()));s=W(v),u=W(h)}if(!(!s||!u)){if(a.period){Ge(typeof r=="string"?Ut[r]??"custom":"custom",[s,u],!1),oe();return}p.dates=[s,u],p.times=[L,a.shape.time?{h:23,mi:59,s:59}:L],S=s,M={...s,d:1},C(),oe()}}function Ke(r,s){let u={...p.times[r],...s};p.times=r===0?[u,p.times[1]]:[p.times[0],u],a.shape.mode==="time"&&!p.dates.length&&(p.dates=[{y:1970,m:1,d:1}]),!p.dates.length&&a.shape.mode==="date"&&(p.dates=[O()]),V(!0)}function Et(r){S=r;let s=M,u=N(M,a.months-1);r.y*12+r.m<s.y*12+s.m?M={y:r.y,m:r.m,d:1}:r.y*12+r.m>u.y*12+u.m&&(M=N({y:r.y,m:r.m,d:1},1-a.months)),C(!0)}function St(r){M=N(M,r),S=N(S,r),C()}function Be(){let[r,s]=p.dates,{mode:u}=a.shape,v=u==="range"?s??Z:null,[h,g]=r&&v?j(r,v)<=0?[r,v]:[v,r]:[r??null,null],D=u==="week"&&r?H(r,0):null;for(let E of P.querySelectorAll(".nv-dt-day")){let x=W(E.dataset.date),w=!1,c=!1,f=!1,y=!1;if(u==="multiple")w=p.dates.some(k=>B(k,x));else if(D){let k=j(x,D);y=k>=0&&k<7,c=k===0,f=k===6}else u==="range"&&h?(c=B(h,x),f=!!g&&B(g,x),y=!!g&&j(x,h)>=0&&j(x,g)<=0):w=B(r??null,x);E.classList.toggle("is-on",w),E.classList.toggle("is-start",c),E.classList.toggle("is-end",f),E.classList.toggle("is-in",y&&!(c&&f)),E.setAttribute("aria-selected",String(w||c||f||y))}}function Qe(r,s,u,v,h){let g=(D,E)=>{let x=b("button",{type:"button",class:"nv-dt-nav","aria-label":`${D<0?a.labels.previous:a.labels.next}: ${h}`,"data-hide":E}),w=i.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("viewBox","0 0 24 24"),w.setAttribute("aria-hidden","true");let c=i.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",D<0?"M15 5l-7 7 7 7":"M9 5l7 7-7 7"),w.append(c),x.append(w),x.addEventListener("click",()=>St(D*v)),x};return b("div",{class:"nv-dt-head"},g(-1,s>0),b("div",{class:"nv-dt-title","aria-live":"polite"},...r),g(1,s<u-1))}function he(r,s){let u=b("button",{type:"button"},r);return u.addEventListener("click",()=>{z=z===s?G(a.shape.mode):s,C(!0)}),u}function At(){let{locale:r}=a.shape,s=xe(r),u=Oe(r,a.firstDay,"short"),v=Oe(r,a.firstDay,"long"),h=new Intl.DateTimeFormat(r,{dateStyle:"full",timeZone:"UTC"}),g=O(),D=b("div",{class:"nv-dt-months"});for(let E=0;E<a.months;E++){let x=N(M,E),w=b("div",{class:"nv-dt-grid",role:"grid","data-weeks":a.weekNumbers,"aria-label":`${s[x.m-1]} ${x.y}`});a.weekNumbers&&w.append(b("span",{class:"nv-dt-dow","aria-hidden":"true"},a.labels.week)),u.forEach((c,f)=>w.append(b("span",{class:"nv-dt-dow",role:"columnheader","aria-label":v[f]},c))),nt(x.y,x.m,a.firstDay).forEach((c,f)=>{a.weekNumbers&&f%7===0&&w.append(b("span",{class:"nv-dt-wk","aria-hidden":"true"},K(de(A(c,(3-a.firstDay+7)%7)).week)));let y=c.m!==x.m;if(y&&a.months>1){w.append(b("span",{}));return}let k=b("button",{type:"button",class:`nv-dt-day${y?" is-out":""}${B(c,g)?" is-today":""}`,"data-date":I(c),"aria-label":h.format(Date.UTC(c.y,c.m-1,c.d,12)),tabindex:B(c,S)?0:-1,disabled:Ae(c)},K(c.d));w.append(k)}),D.append(b("div",{class:"nv-dt-month"},Qe([he(s[x.m-1],"months"),he(K(x.y),"years")],E,a.months,1,s[x.m-1]),w))}return D}function zt(){let{locale:r,mode:s}=a.shape,[u]=p.dates,v=O(),h=b("div",{class:"nv-dt-cells","data-view":z,role:"grid"}),g=(c,f,y,k,J,se)=>{let Me=b("button",{type:"button",class:`nv-dt-cell${k?" is-on":""}${J?" is-now":""}`,"data-date":I(c),"aria-pressed":k,tabindex:D(c,S)?0:-1,disabled:wt(c,f)},y);se&&Me.append(b("small",{},se)),Me.addEventListener("click",()=>Ye(c)),h.append(Me)},D=(c,f)=>z==="years"?c.y===f.y:z==="quarters"?c.y===f.y&&R(c.m)===R(f.m):c.y===f.y&&c.m===f.m,E=c=>!!u&&z===G(s)&&D(c,u),x,w=12;if(z==="years"){let c=Math.floor(M.y/12)*12;for(let f=c;f<c+12;f++)g({y:f,m:1,d:1},{y:f,m:12,d:31},K(f),E({y:f,m:1,d:1}),f===v.y);x=[b("span",{},`${K(c)} \u2013 ${K(c+11)}`)],w=144}else if(z==="quarters"){let c=xe(r,"short");for(let f=0;f<4;f++){let y={y:M.y,m:f*3+1,d:1},k=A(N(y,3),-1);g(y,k,`${a.labels.quarter}${K(f+1)}`,E(y),v.y===y.y&&R(v.m)===f+1,`${c[f*3]} \u2013 ${c[f*3+2]}`)}x=[he(K(M.y),"years")]}else xe(r,"short").forEach((c,f)=>{let y={y:M.y,m:f+1,d:1};g(y,A(N(y,1),-1),c,E(y),v.y===y.y&&v.m===f+1)}),x=[he(K(M.y),"years")];return b("div",{class:"nv-dt-month"},Qe(x,0,1,w,z),h)}function ze(r,s){let u=p.times[r],v=b("div",{class:"nv-dt-time"},b("span",{},s)),h=(D,E,x,w,c,f)=>{let y=b("input",{type:"number",inputmode:"numeric",min:x,max:w,step:c,value:String(E).padStart(2,"0"),"aria-label":`${s} ${f}`});return y.addEventListener("change",()=>{let k=Math.min(w,Math.max(x,Math.round(Number(y.value)||0)));D==="h"&&a.hour12&&(k=k%12+(p.times[r].h>=12?12:0)),y.value=String(D==="h"&&a.hour12?k%12||12:k).padStart(2,"0"),Ke(r,{[D]:k})}),y},g=D=>{try{return new Intl.DisplayNames(a.shape.locale,{type:"dateTimeField"}).of(D)??D}catch{return D}};if(v.append(a.hour12?h("h",u.h%12||12,1,12,1,g("hour")):h("h",u.h,0,23,1,g("hour"))),v.append(b("span",{"aria-hidden":"true"},":"),h("mi",u.mi,0,59,a.minuteStep,g("minute"))),a.shape.seconds&&v.append(b("span",{"aria-hidden":"true"},":"),h("s",u.s,0,59,1,g("second"))),a.hour12){let D=new Intl.DateTimeFormat(a.shape.locale,{hour:"numeric",hour12:!0,timeZone:"UTC"}),E=w=>D.formatToParts(Date.UTC(2024,0,1,w)).find(c=>c.type==="dayPeriod")?.value??(w<12?"AM":"PM"),x=b("button",{type:"button"},E(u.h));x.addEventListener("click",()=>{let w=(p.times[r].h+12)%24;x.textContent=E(w),Ke(r,{h:w})}),v.append(x)}return v}function C(r=!1){let{mode:s,time:u,locale:v}=a.shape,h=r||P.contains(l.activeElement);if(P.className=`nv-dt${o&&!a.inline?" nv-dt-pop":""}${d.orientation==="vertical"?" nv-dt-vertical":""}${d.class?` ${d.class}`:""}`,P.dir=a.rtl?"rtl":"ltr",P.lang=v,P.dataset.theme=d.theme??"auto",P.dataset.mode=s,d.accent?P.style.setProperty("--nv-dt-accent",d.accent):P.style.removeProperty("--nv-dt-accent"),o&&!a.inline&&(P.setAttribute("role","dialog"),P.setAttribute("aria-label",o.getAttribute("aria-label")??o.placeholder??s)),P.replaceChildren(),a.presets.length){let c=b("div",{class:"nv-dt-presets"}),f=JSON.stringify(a.period?ie().value:pe(p,{...a.shape,time:!1}));for(let y of a.presets){let k=typeof y=="string"?a.labels.periods[y]:y.label,J=typeof y=="string"?ee(y,O(),a.firstDay).map(I):y.range(I(O())),se=b("button",{type:"button","aria-pressed":JSON.stringify({start:J[0],end:J[1]})===f},k);se.addEventListener("click",()=>Tt(y)),c.append(se)}P.append(c)}let g=b("div",{class:"nv-dt-main"});if(a.period&&a.granularities.length>1){let c=new Intl.DisplayNames(v,{type:"dateTimeField"}),f={day:"day",week:"weekOfYear",month:"month",quarter:"quarter",year:"year",custom:""},y=b("div",{class:"nv-dt-tabs",role:"tablist"});for(let k of a.granularities){let J=b("button",{type:"button",role:"tab","aria-selected":k===m,"data-granularity":k},k==="custom"?a.labels.custom:c.of(f[k])??k);J.addEventListener("click",()=>Ge(k)),y.append(J)}g.append(y)}if(s!=="time"&&g.append(z==="days"?At():zt()),u){let c=b("div",{class:"nv-dt-times"});s==="range"?c.append(ze(0,a.labels.from),ze(1,a.labels.to)):c.append(ze(0,a.labels.time)),g.append(c)}if(a.zones.length||u&&a.shape.zone!==Pe("local")){let c=Date.now(),f=b("label",{class:"nv-dt-zone"},b("span",{},a.labels.zone));if(a.zones.length){let y=b("select",{});for(let k of new Set([a.shape.zone,...a.zones]))y.append(b("option",{value:k,selected:k===a.shape.zone},`${k.replace(/_/g," ")} (${Fe(c,k,v)})`));y.addEventListener("change",()=>et.update({zone:y.value})),f.append(y)}else f.append(b("span",{},`${a.shape.zone.replace(/_/g," ")} (${Fe(c,a.shape.zone,v)})`));g.append(f)}if(a.period&&d.compare===!0){let c=b("label",{class:"nv-dt-zone nv-dt-compare"},b("span",{},a.labels.compareTo)),f=b("select",{});for(let[y,k]of[["previousYear",a.labels.previousYear],["previousPeriod",a.labels.previousPeriod],["none",a.labels.none]])f.append(b("option",{value:y,selected:y===T},k));f.addEventListener("change",()=>{T=f.value,V(we(p,a.shape.mode))}),c.append(f),g.append(c)}let D=b("div",{class:"nv-dt-foot"}),E=b("div",{}),x=b("div",{}),w=(c,f,y="")=>{let k=b("button",{type:"button",class:y},c);return k.addEventListener("click",f),k};E.append(w(u?a.labels.now:a.labels.today,()=>{let c=O();if(u){let f=te(Date.now(),a.shape.zone);p.times=[{h:f.h,mi:f.mi,s:a.shape.seconds?f.s:0},p.times[1]]}z=G(s),M={...c,d:1},s==="range"||s==="multiple"?(S=c,C(!0)):s==="time"?(p.dates=[{y:1970,m:1,d:1}],C(!0),oe()):z==="days"?Ze(c):Ye(c)})),x.append(w(a.labels.clear,()=>{p=re(),Z=null,C(!0),V(!0)})),o&&!a.inline&&!a.autoClose&&x.append(w(a.labels.apply,_,"nv-dt-apply")),D.append(E,x),g.append(D),P.append(g),Be(),h&&P.querySelector('[tabindex="0"]')?.focus()}P.addEventListener("click",r=>{let s=r.target.closest(".nv-dt-day");s&&!s.disabled&&Ze(W(s.dataset.date))}),P.addEventListener("pointerover",r=>{if(a.shape.mode!=="range"||p.dates.length!==1)return;let s=r.target.closest(".nv-dt-day"),u=s?W(s.dataset.date):null;!B(u,Z)&&(u||Z)&&(Z=u,Be())}),P.addEventListener("keydown",r=>{let s=r.target;if(r.key==="Escape"&&o&&!a.inline){r.preventDefault(),_(),o.focus();return}let u=s.classList.contains("nv-dt-day");if(!u&&!s.classList.contains("nv-dt-cell"))return;let v=a.rtl?-1:1,h=null;if(u){let g={ArrowLeft:-v,ArrowRight:v,ArrowUp:-7,ArrowDown:7};r.key in g?h=A(S,g[r.key]):r.key==="Home"?h=H(S,a.firstDay):r.key==="End"?h=A(H(S,a.firstDay),6):r.key==="PageUp"?h=N(S,r.shiftKey?-12:-1):r.key==="PageDown"&&(h=N(S,r.shiftKey?12:1)),h&&a.shape.mode==="range"&&p.dates.length===1&&(Z=h)}else{let g=z==="years"?12:z==="quarters"?3:1,D=z==="quarters"?2:3,E={ArrowLeft:-v,ArrowRight:v,ArrowUp:-D,ArrowDown:D,PageUp:-12/g,PageDown:12/g};r.key in E&&(h=N({...S,d:1},E[r.key]*g),M=z==="years"?{y:h.y,m:1,d:1}:{y:h.y,m:M.m,d:1})}h&&(r.preventDefault(),u?Et(h):(S=h,C(!0)))});function ge(){if(!o||a.inline||!F)return;let r=i.defaultView,s=o.getBoundingClientRect(),u=P.offsetHeight,v=P.offsetWidth,h=r.innerHeight-s.bottom,g=h<u+8&&s.top>h?s.top-u-4:s.bottom+4,D=a.rtl?s.right-v:s.left;P.style.top=`${Math.max(4,g)+r.scrollY}px`,P.style.left=`${Math.max(4,Math.min(D,r.innerWidth-v-4))+r.scrollX}px`}function Q(){F||a.inline||(F=!0,S=p.dates[0]??O(),M={...S,d:1},z=G(a.shape.mode),P.hidden=!1,C(),ge(),o?.setAttribute("aria-expanded","true"),d.onOpen?.())}function _(){!F||a.inline||(F=!1,Z=null,a.shape.mode==="range"&&p.dates.length===1&&(p=re(),V(!1)),P.hidden=!0,o?.setAttribute("aria-expanded","false"),d.onClose?.())}let _e=r=>{let s=r.composedPath();F&&!s.includes(P)&&!s.includes(t)&&_()},Je=r=>{r.key==="ArrowDown"||r.key==="Enter"&&!F?(r.preventDefault(),Q(),P.querySelector('[tabindex="0"], input, button')?.focus()):r.key==="Escape"&&_()},Xe=()=>{let r=Te(o.value,a.shape);r.dates.length&&!r.dates.some(Ae)?(p=r,S=p.dates[0],M={...S,d:1},F&&C(),V(!0)):V(!1)},ye=()=>ge();function Mt(){o&&!a.inline?(P.hidden=!0,(l.nodeType===11?l:i.body).append(P),o.setAttribute("autocomplete","off"),o.setAttribute("aria-haspopup","dialog"),o.setAttribute("aria-expanded","false"),d.placeholder&&(o.placeholder=d.placeholder),o.name&&!Y&&(Y=b("input",{type:"hidden",name:o.name}),o.removeAttribute("name"),o.after(Y)),o.addEventListener("focus",Q),o.addEventListener("click",Q),o.addEventListener("keydown",Je),o.addEventListener("change",Xe),i.addEventListener("pointerdown",_e,!0),i.defaultView.addEventListener("resize",ye),i.defaultView.addEventListener("scroll",ye,!0)):(o?o.after(P):t.append(P),C()),V(!1)}let et={element:P,getValue:()=>a.period?ie().value:pe(p,a.shape),getSelection:ie,setValue(r){p=$(r),z=G(a.shape.mode),S=p.dates[0]??O(),M={...S,d:1},(F||a.inline)&&C(),V(!1)},update(r){let s=a.shape,u=(d.mode??"date")===(r.mode??d.mode??"date"),v=a.period?ie().value:pe(p,s),h="value"in r?r.value:u?v:null;d={...d,...r},"compare"in r&&(T=Dt(d.compare)),a=Ee(d,i,!!o,m),p=$(h),S=p.dates[0]??O(),M={...S,d:1},z=G(a.shape.mode),(F||a.inline)&&C(),ge(),V(!1)},open:Q,close:_,toggle:()=>F?_():Q(),destroy(){P.remove(),o&&(o.removeEventListener("focus",Q),o.removeEventListener("click",Q),o.removeEventListener("keydown",Je),o.removeEventListener("change",Xe),Y&&(o.name=Y.name,Y.remove(),Y=null)),i.removeEventListener("pointerdown",_e,!0),i.defaultView?.removeEventListener("resize",ye),i.defaultView?.removeEventListener("scroll",ye,!0)}};return Mt(),et}var Ht=["mode","value","zone","zones","locale","min","max","months","time","seconds","minute-step","hour12","first-day","week-numbers","presets","granularity","granularities","compare","orientation","inline","placeholder","accent","theme","name","disabled"],qt=typeof HTMLElement>"u"?Object:HTMLElement,ve=class extends qt{constructor(){super(...arguments);be(this,"picker",null);be(this,"extra",{})}connectedCallback(){this.render()}disconnectedCallback(){this.picker?.destroy(),this.picker=null}attributeChangedCallback(t,i,l){!this.isConnected||i===l||(t==="value"?this.picker?.setValue(this.parse(l)):t==="inline"||t==="name"||t==="disabled"?this.render():this.picker?.update(this.read()))}get value(){return this.picker?.getValue()??null}set value(t){this.picker?.setValue(t)}get selection(){return this.picker?.getSelection()??null}set options(t){this.extra=t,this.picker?.update({...this.read(),...t})}open(){this.picker?.open()}close(){this.picker?.close()}parse(t){if(!t)return null;let i=t.trim();if(i.startsWith("{")||i.startsWith("["))try{return JSON.parse(i)}catch{return null}if(i.includes("/")){let[l,o]=i.split("/");return{start:l,end:o}}return i.includes(",")?i.split(",").map(l=>l.trim()):i}read(){let t=o=>this.getAttribute(o)??void 0,i=o=>this.hasAttribute(o)?this.getAttribute(o)!=="false":void 0,l=o=>this.hasAttribute(o)?Number(this.getAttribute(o)):void 0;return{mode:t("mode"),zone:t("zone"),zones:t("zones")?.split(",").map(o=>o.trim()).filter(Boolean),locale:t("locale"),min:t("min"),max:t("max"),months:l("months"),time:i("time"),seconds:i("seconds"),minuteStep:l("minute-step"),hour12:i("hour12"),firstDay:l("first-day"),weekNumbers:i("week-numbers"),presets:i("presets"),granularity:t("granularity"),granularities:t("granularities")?.split(",").map(o=>o.trim()).filter(Boolean),compare:this.hasAttribute("compare")?["","true"].includes(t("compare")??"")?!0:t("compare"):void 0,orientation:t("orientation"),inline:i("inline"),placeholder:t("placeholder"),accent:t("accent"),theme:t("theme")}}render(){let t=this.picker?this.picker.getValue():this.parse(this.getAttribute("value"));this.picker?.destroy(),this.replaceChildren();let i=this.hasAttribute("inline")&&this.getAttribute("inline")!=="false",l=null;if(!i){let o=this.ownerDocument.createElement("input");o.type="text",o.className="nv-datetime-field";let d=this.getAttribute("name");d&&(o.name=d),o.disabled=this.hasAttribute("disabled");let m=this.getAttribute("aria-label");m&&o.setAttribute("aria-label",m),this.append(o),l=o}this.picker=Se(l??this,{...this.read(),...this.extra,value:t,onChange:o=>{this.extra.onChange?.(o),this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0}))}})}};be(ve,"observedAttributes",Ht);function We(e="nv-datetime"){typeof customElements>"u"||customElements.get(e)||customElements.define(e,e==="nv-datetime"?ve:class extends ve{})}We();We();globalThis.nervureDateTime={createDatePicker:Se,injectStyles:Re,pickerCss:fe,labelsFor:ce,period:ee,PERIODS:ue,LANGUAGES:Ie};})();
@@ -0,0 +1,51 @@
1
+ /** A calendar date, without time or zone. `m` is 1 to 12. */
2
+ export interface PlainDate {
3
+ readonly y: number;
4
+ readonly m: number;
5
+ readonly d: number;
6
+ }
7
+ /** A time of day. */
8
+ export interface PlainTime {
9
+ readonly h: number;
10
+ readonly mi: number;
11
+ readonly s: number;
12
+ }
13
+ /** Days since 1970-01-01. */
14
+ export declare const dayNumber: (p: PlainDate) => number;
15
+ /** The date of a day number. */
16
+ export declare function fromDayNumber(n: number): PlainDate;
17
+ export declare const compare: (a: PlainDate, b: PlainDate) => number;
18
+ export declare const same: (a: PlainDate | null, b: PlainDate | null) => boolean;
19
+ export declare const addDays: (p: PlainDate, n: number) => PlainDate;
20
+ export declare const daysInMonth: (y: number, m: number) => number;
21
+ /** Adds months and keeps the day when the month has it (31 January + 1 month = 28 or 29 February). */
22
+ export declare function addMonths(p: PlainDate, n: number): PlainDate;
23
+ /** Day of the week: 0 Monday to 6 Sunday. */
24
+ export declare const weekday: (p: PlainDate) => number;
25
+ /** First day of the week that holds `p`. `firstDay` is 0 Monday to 6 Sunday. */
26
+ export declare const startOfWeek: (p: PlainDate, firstDay: number) => PlainDate;
27
+ /** ISO 8601 week: the week with the first Thursday of the year is week 1. */
28
+ export declare function isoWeek(p: PlainDate): {
29
+ year: number;
30
+ week: number;
31
+ };
32
+ /** Monday of an ISO week. */
33
+ export declare function fromIsoWeek(year: number, week: number): PlainDate;
34
+ export declare const quarterOf: (m: number) => number;
35
+ /** The six weeks shown for a month: 42 dates, from the first day of the first week. */
36
+ export declare function monthGrid(y: number, m: number, firstDay: number): PlainDate[];
37
+ export declare const clampDate: (p: PlainDate, min: PlainDate | null, max: PlainDate | null) => PlainDate;
38
+ export declare const dateText: (p: PlainDate) => string;
39
+ export declare const timeText: (t: PlainTime, seconds?: boolean) => string;
40
+ export declare const monthText: (p: PlainDate) => string;
41
+ export declare const quarterText: (p: PlainDate) => string;
42
+ export declare function weekText(p: PlainDate): string;
43
+ /** Reads `2026-12-04`. Returns null for a text that is not a real date. */
44
+ export declare function parseDate(text: string): PlainDate | null;
45
+ /** Reads `14:30` or `14:30:15`. */
46
+ export declare function parseTime(text: string): PlainTime | null;
47
+ /** Names of the ready-made periods. */
48
+ export type PeriodName = 'today' | 'yesterday' | 'last7' | 'last30' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'thisQuarter' | 'lastQuarter' | 'thisYear' | 'lastYear' | 'yearToDate';
49
+ export declare const PERIODS: readonly PeriodName[];
50
+ /** First and last day (both included) of a ready-made period, counted from `today`. */
51
+ export declare function period(name: PeriodName, today: PlainDate, firstDay: number): [PlainDate, PlainDate];
@@ -0,0 +1,125 @@
1
+ // Calendar arithmetic on plain dates (year, month 1-12, day), with no time zone: the proleptic Gregorian calendar.
2
+ const DAY = 86_400_000;
3
+ const pad = (n, size = 2) => String(n).padStart(size, '0');
4
+ /** Days since 1970-01-01. */
5
+ export const dayNumber = (p) => Math.floor(Date.UTC(p.y, p.m - 1, p.d) / DAY);
6
+ /** The date of a day number. */
7
+ export function fromDayNumber(n) {
8
+ const t = new Date(n * DAY);
9
+ return { y: t.getUTCFullYear(), m: t.getUTCMonth() + 1, d: t.getUTCDate() };
10
+ }
11
+ export const compare = (a, b) => dayNumber(a) - dayNumber(b);
12
+ export const same = (a, b) => !!a && !!b && a.y === b.y && a.m === b.m && a.d === b.d;
13
+ export const addDays = (p, n) => fromDayNumber(dayNumber(p) + n);
14
+ export const daysInMonth = (y, m) => new Date(Date.UTC(y, m, 0)).getUTCDate();
15
+ /** Adds months and keeps the day when the month has it (31 January + 1 month = 28 or 29 February). */
16
+ export function addMonths(p, n) {
17
+ const index = p.y * 12 + (p.m - 1) + n;
18
+ const y = Math.floor(index / 12);
19
+ const m = (((index % 12) + 12) % 12) + 1;
20
+ return { y, m, d: Math.min(p.d, daysInMonth(y, m)) };
21
+ }
22
+ /** Day of the week: 0 Monday to 6 Sunday. */
23
+ export const weekday = (p) => (new Date(Date.UTC(p.y, p.m - 1, p.d)).getUTCDay() + 6) % 7;
24
+ /** First day of the week that holds `p`. `firstDay` is 0 Monday to 6 Sunday. */
25
+ export const startOfWeek = (p, firstDay) => addDays(p, -((weekday(p) - firstDay + 7) % 7));
26
+ /** ISO 8601 week: the week with the first Thursday of the year is week 1. */
27
+ export function isoWeek(p) {
28
+ const thursday = addDays(p, 3 - weekday(p));
29
+ const first = dayNumber({ y: thursday.y, m: 1, d: 1 });
30
+ return { year: thursday.y, week: Math.floor((dayNumber(thursday) - first) / 7) + 1 };
31
+ }
32
+ /** Monday of an ISO week. */
33
+ export function fromIsoWeek(year, week) {
34
+ const jan4 = { y: year, m: 1, d: 4 };
35
+ return addDays(startOfWeek(jan4, 0), (week - 1) * 7);
36
+ }
37
+ export const quarterOf = (m) => Math.floor((m - 1) / 3) + 1;
38
+ /** The six weeks shown for a month: 42 dates, from the first day of the first week. */
39
+ export function monthGrid(y, m, firstDay) {
40
+ const start = startOfWeek({ y, m, d: 1 }, firstDay);
41
+ return Array.from({ length: 42 }, (_, i) => addDays(start, i));
42
+ }
43
+ export const clampDate = (p, min, max) => min && compare(p, min) < 0 ? min : max && compare(p, max) > 0 ? max : p;
44
+ // ── Text forms (ISO 8601) ──────────────────────────────────────────────────────────────────────────────────────
45
+ export const dateText = (p) => `${pad(p.y, 4)}-${pad(p.m)}-${pad(p.d)}`;
46
+ export const timeText = (t, seconds = false) => `${pad(t.h)}:${pad(t.mi)}${seconds ? `:${pad(t.s)}` : ''}`;
47
+ export const monthText = (p) => `${pad(p.y, 4)}-${pad(p.m)}`;
48
+ export const quarterText = (p) => `${pad(p.y, 4)}-Q${quarterOf(p.m)}`;
49
+ export function weekText(p) {
50
+ const w = isoWeek(p);
51
+ return `${pad(w.year, 4)}-W${pad(w.week)}`;
52
+ }
53
+ /** Reads `2026-12-04`. Returns null for a text that is not a real date. */
54
+ export function parseDate(text) {
55
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(text.trim());
56
+ if (!m)
57
+ return null;
58
+ const p = { y: +m[1], m: +m[2], d: +m[3] };
59
+ return p.m >= 1 && p.m <= 12 && p.d >= 1 && p.d <= daysInMonth(p.y, p.m) ? p : null;
60
+ }
61
+ /** Reads `14:30` or `14:30:15`. */
62
+ export function parseTime(text) {
63
+ const m = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(text.trim());
64
+ if (!m)
65
+ return null;
66
+ const t = { h: +m[1], mi: +m[2], s: +(m[3] ?? 0) };
67
+ return t.h < 24 && t.mi < 60 && t.s < 60 ? t : null;
68
+ }
69
+ export const PERIODS = [
70
+ 'today',
71
+ 'yesterday',
72
+ 'last7',
73
+ 'last30',
74
+ 'thisWeek',
75
+ 'lastWeek',
76
+ 'thisMonth',
77
+ 'lastMonth',
78
+ 'thisQuarter',
79
+ 'lastQuarter',
80
+ 'thisYear',
81
+ 'lastYear',
82
+ 'yearToDate',
83
+ ];
84
+ const monthSpan = (y, m, count) => {
85
+ const start = { y, m, d: 1 };
86
+ const last = addMonths(start, count - 1);
87
+ return [start, { y: last.y, m: last.m, d: daysInMonth(last.y, last.m) }];
88
+ };
89
+ /** First and last day (both included) of a ready-made period, counted from `today`. */
90
+ export function period(name, today, firstDay) {
91
+ const week = startOfWeek(today, firstDay);
92
+ const q = (quarterOf(today.m) - 1) * 3 + 1;
93
+ switch (name) {
94
+ case 'today':
95
+ return [today, today];
96
+ case 'yesterday':
97
+ return [addDays(today, -1), addDays(today, -1)];
98
+ case 'last7':
99
+ return [addDays(today, -6), today];
100
+ case 'last30':
101
+ return [addDays(today, -29), today];
102
+ case 'thisWeek':
103
+ return [week, addDays(week, 6)];
104
+ case 'lastWeek':
105
+ return [addDays(week, -7), addDays(week, -1)];
106
+ case 'thisMonth':
107
+ return monthSpan(today.y, today.m, 1);
108
+ case 'lastMonth': {
109
+ const p = addMonths({ ...today, d: 1 }, -1);
110
+ return monthSpan(p.y, p.m, 1);
111
+ }
112
+ case 'thisQuarter':
113
+ return monthSpan(today.y, q, 3);
114
+ case 'lastQuarter': {
115
+ const p = addMonths({ y: today.y, m: q, d: 1 }, -3);
116
+ return monthSpan(p.y, p.m, 3);
117
+ }
118
+ case 'thisYear':
119
+ return monthSpan(today.y, 1, 12);
120
+ case 'lastYear':
121
+ return monthSpan(today.y - 1, 1, 12);
122
+ case 'yearToDate':
123
+ return [{ y: today.y, m: 1, d: 1 }, today];
124
+ }
125
+ }
package/dist/cdn.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cdn.js ADDED
@@ -0,0 +1,13 @@
1
+ // The one-file build: registers <nv-datetime> and exposes window.nervureDateTime.
2
+ import { defineDateTimeElement } from "./element.js";
3
+ import { LANGUAGES, PERIODS, createDatePicker, injectStyles, labelsFor, period, pickerCss } from "./index.js";
4
+ defineDateTimeElement();
5
+ globalThis.nervureDateTime = {
6
+ createDatePicker,
7
+ injectStyles,
8
+ pickerCss,
9
+ labelsFor,
10
+ period,
11
+ PERIODS,
12
+ LANGUAGES,
13
+ };
package/dist/core.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { Picker, PickerOptions } from './types.ts';
2
+ export { pickerCss } from './styles.ts';
3
+ export { LANGUAGES, labelsFor } from './i18n.ts';
4
+ export { PERIODS, period } from './calendar.ts';
5
+ export { instant, localZone, offsetMinutes, wallClock } from './zone.ts';
6
+ export type { Labels } from './i18n.ts';
7
+ export type { PeriodName, PlainDate, PlainTime } from './calendar.ts';
8
+ export type * from './types.ts';
9
+ /** Adds the stylesheet to a document or a shadow root, once. `createDatePicker` calls it for you. */
10
+ export declare function injectStyles(root?: Document | ShadowRoot | undefined): void;
11
+ /**
12
+ * Makes a picker. On a text field, the panel opens under it; on any other element, the calendar is drawn inside it.
13
+ * `target` is an element or a CSS selector.
14
+ */
15
+ export declare function createDatePicker(target: HTMLElement | string, options?: PickerOptions): Picker;