ngxsmk-datepicker 2.2.12 → 2.2.13
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 +1218 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +1775 -0
- package/README.md +923 -920
- package/docs/API.md +1 -1
- package/docs/COMPATIBILITY.md +1 -1
- package/docs/INTEGRATION.md +1 -1
- package/docs/IONIC_INTEGRATION.md +1 -1
- package/docs/IONIC_TESTING.md +1 -1
- package/docs/LOCALE-GUIDE.md +1 -1
- package/docs/PLUGIN-ARCHITECTURE.md +1 -1
- package/docs/SEO.md +1 -1
- package/docs/SSR-EXAMPLE.md +1 -1
- package/docs/THEME-TOKENS.md +1 -1
- package/docs/TIMEZONE.md +1 -1
- package/docs/extension-points.md +1 -1
- package/docs/signal-forms.md +1 -1
- package/docs/signals.md +1 -1
- package/docs/ssr.md +1 -1
- package/fesm2022/ngxsmk-datepicker.mjs +14193 -0
- package/package.json +94 -92
- package/types/ngxsmk-datepicker.d.ts +2433 -0
package/README.md
CHANGED
|
@@ -1,920 +1,923 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
SEO Keywords: Angular DatePicker, Angular Date Range Picker, Lightweight Calendar Component, Angular Signals DatePicker, SSR Ready DatePicker, Zoneless Angular, A11y DatePicker, Mobile-Friendly DatePicker, Ionic DatePicker
|
|
3
|
-
Meta Description: The most powerful, lightweight, and accessible date and range picker for modern Angular (17-21+). Built with Signals, Zoneless-ready, and zero dependencies.
|
|
4
|
-
-->
|
|
5
|
-
|
|
6
|
-
<div align="center">
|
|
7
|
-
<img src="projects/ngxsmk-datepicker/docs/header-banner.png" alt="ngxsmk-datepicker - Lightweight Angular Date Range Picker" width="100%" />
|
|
8
|
-
|
|
9
|
-
# **ngxsmk-datepicker** – Modern Angular Date Picker & Range Picker
|
|
10
|
-
|
|
11
|
-
### _The Gold Standard for Premium Angular Calendar Selection_
|
|
12
|
-
|
|
13
|
-
[](https://www.npmjs.com/package/ngxsmk-datepicker)
|
|
14
|
-
[](https://angular.io/)
|
|
15
|
-
[](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/LICENSE)
|
|
16
|
-
[](https://buymeacoffee.com/toozuuu)
|
|
17
|
-
[](https://bundlephobia.com/package/ngxsmk-datepicker)
|
|
18
|
-
[](https://angular.dev/guide/zoneless)
|
|
19
|
-
|
|
20
|
-
**`npm i ngxsmk-datepicker`**
|
|
21
|
-
|
|
22
|
-
[Explore Live Demo](https://ngxsmk.github.io/ngxsmk-datepicker/) • [Buy me a coffee](https://buymeacoffee.com/toozuuu) • [API Documentation](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/API.md) • [Submit Issue](https://github.com/NGXSMK/ngxsmk-datepicker/issues)
|
|
23
|
-
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
**Last updated:** May
|
|
29
|
-
|
|
30
|
-
### **Overview**
|
|
31
|
-
|
|
32
|
-
**ngxsmk-datepicker** is a high-performance, enterprise-ready date and range picker engineered for the modern Angular ecosystem (v17+). Built from the ground up with **Angular Signals**, it delivers a seamless, zoneless-ready experience for both desktop and mobile (Ionic) applications.
|
|
33
|
-
|
|
34
|
-
> **Stable Release**: `v2.2.
|
|
35
|
-
>
|
|
36
|
-
>
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
### **📌 Table of Contents**
|
|
41
|
-
|
|
42
|
-
1. [📷 Screenshots](#-screenshots)
|
|
43
|
-
2. [✨ Features](#-features)
|
|
44
|
-
3. [📋 Compatibility](#-compatibility)
|
|
45
|
-
4. [🌍 Localization (i18n)](#-localization-i18n)
|
|
46
|
-
5. [📦 Installation](#-installation)
|
|
47
|
-
6. [🚀 Quick Start](#-quick-start)
|
|
48
|
-
7. [🔌 Framework Integration](#-framework-integration)
|
|
49
|
-
8. [⚙️ API Reference](#-api-reference)
|
|
50
|
-
9. [🎨 Theming](#-theming)
|
|
51
|
-
10. [⌨️ Keyboard Navigation](#-keyboard-navigation)
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## 📷 Screenshots
|
|
56
|
-
|
|
57
|
-
<p align="center">
|
|
58
|
-
<img src="https://github.com/NGXSMK/ngxsmk-datepicker/raw/main/projects/ngxsmk-datepicker/docs/1.png" alt="Angular Standalone DatePicker Single Selection Mode" width="30%" />
|
|
59
|
-
<img src="https://github.com/NGXSMK/ngxsmk-datepicker/raw/main/projects/ngxsmk-datepicker/docs/2.png" alt="Angular Date Range Picker Selection Mode" width="30%" />
|
|
60
|
-
<img src="https://github.com/NGXSMK/ngxsmk-datepicker/raw/main/projects/ngxsmk-datepicker/docs/3.png" alt="Mobile Angular DatePicker Ionic Compatibility" width="30%" />
|
|
61
|
-
</p>
|
|
62
|
-
|
|
63
|
-
## **✨ Features**
|
|
64
|
-
|
|
65
|
-
### **Core Capabilities**
|
|
66
|
-
|
|
67
|
-
- 💎 **Signal-Driven Engine**: Hyper-reactive state management using Angular Signals.
|
|
68
|
-
- 🌓 **Native Dark Mode**: Beautifully crafted themes for light and dark environments.
|
|
69
|
-
- 📱 **Mobile-First UX**: Native mobile picker integration with touch gestures and haptic feedback.
|
|
70
|
-
- 🧩 **Zero Dependencies**: Lightweight standalone component with no external bloat.
|
|
71
|
-
- ⚡ **Performance++**: Lazy-loaded calendar months, memoized calculations, and tree-shakable architecture.
|
|
72
|
-
|
|
73
|
-
### **Advanced Functionality**
|
|
74
|
-
|
|
75
|
-
- 📅 **Google Calendar Sync**: Built-in support for seamlessly syncing and displaying events natively from Google Calendar.
|
|
76
|
-
- 🌐 **8-Language i18n**: Full localization for `en`, `de`, `es`, `sv`, `ko`, `zh`, `ja`, and `fr`.
|
|
77
|
-
- 🛠️ **Plugin Architecture**: Extend functionality via hooks for rendering, validation, and shortcuts.
|
|
78
|
-
- 🧪 **Signal Forms Native**: Direct integration with Angular 21's new Signal Forms API.
|
|
79
|
-
- 🚀 **Zoneless Ready**: Optimized for the future of Angular—works perfectly without zone.js.
|
|
80
|
-
- ♿ **Full Accessibility**: WAI-ARIA compliant with extensive keyboard navigation support.
|
|
81
|
-
|
|
82
|
-
## **📋 Compatibility**
|
|
83
|
-
|
|
84
|
-
For detailed compatibility information, see [COMPATIBILITY.md](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/COMPATIBILITY.md).
|
|
85
|
-
|
|
86
|
-
### Quick Reference
|
|
87
|
-
|
|
88
|
-
| Angular Version | Status | Core Features | Signal Forms | SSR | Zoneless |
|
|
89
|
-
| --------------- | ------------------ | ------------- | ------------ | --- | -------- |
|
|
90
|
-
| Angular 17 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
91
|
-
| Angular 18 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
92
|
-
| Angular 19 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
93
|
-
| Angular 20 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
94
|
-
| Angular 21 | ✅ Fully Supported | ✅ All | ✅ | ✅ | ✅ |
|
|
95
|
-
| Angular 22+ | 🔄 Future Support | ✅ All | ✅ | ✅ | ✅ |
|
|
96
|
-
|
|
97
|
-
**Zone.js**: Optional - The library works with or without Zone.js (zoneless apps supported)
|
|
98
|
-
|
|
99
|
-
**SSR**: ✅ Fully compatible with Angular Universal and server-side rendering
|
|
100
|
-
|
|
101
|
-
**Peer Dependencies**: `@angular/core >=17.0.0 <24.0.0`
|
|
102
|
-
|
|
103
|
-
## **🔒 API Stability & Deprecation Policy**
|
|
104
|
-
|
|
105
|
-
### API Stability Guarantees
|
|
106
|
-
|
|
107
|
-
- **Public API**: All public APIs (inputs, outputs, methods) are stable within a major version
|
|
108
|
-
- **Experimental Features**: Features marked as `experimental` may change in minor versions
|
|
109
|
-
- **Internal APIs**: Private methods and internal services are not part of the public API and may change without notice
|
|
110
|
-
|
|
111
|
-
### Deprecation Policy
|
|
112
|
-
|
|
113
|
-
- **Deprecation Period**: Features are deprecated for at least **2 major versions** before removal
|
|
114
|
-
- **Deprecation Warnings**:
|
|
115
|
-
- `@deprecated` JSDoc tags in code
|
|
116
|
-
- Console warnings in development mode
|
|
117
|
-
- Clear documentation in CHANGELOG.md
|
|
118
|
-
- **Migration Guides**: Provided in `MIGRATION.md` for all breaking changes
|
|
119
|
-
- **Breaking Changes**: Only occur in major version releases (semver)
|
|
120
|
-
|
|
121
|
-
### Stable APIs
|
|
122
|
-
|
|
123
|
-
The following are considered stable public APIs:
|
|
124
|
-
|
|
125
|
-
- Component inputs and outputs (`@Input()`, `@Output()`)
|
|
126
|
-
- Public methods documented in API docs
|
|
127
|
-
- Exported types and interfaces
|
|
128
|
-
- Service APIs (when marked as public)
|
|
129
|
-
|
|
130
|
-
### Experimental Features
|
|
131
|
-
|
|
132
|
-
Features marked as experimental may change:
|
|
133
|
-
|
|
134
|
-
- Signal Forms support (`[field]` input) - Experimental in v1.9.x, stable in v2.0.0+
|
|
135
|
-
- Some advanced selection modes
|
|
136
|
-
- Plugin architecture hooks (subject to refinement)
|
|
137
|
-
|
|
138
|
-
For details, see [CONTRIBUTING.md](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/CONTRIBUTING.md#deprecation-policy).
|
|
139
|
-
|
|
140
|
-
##
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
@
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
<
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
|
502
|
-
|
|
|
503
|
-
|
|
|
504
|
-
|
|
|
505
|
-
|
|
|
506
|
-
|
|
|
507
|
-
|
|
|
508
|
-
|
|
|
509
|
-
|
|
|
510
|
-
|
|
|
511
|
-
|
|
|
512
|
-
|
|
|
513
|
-
|
|
|
514
|
-
|
|
|
515
|
-
|
|
|
516
|
-
|
|
|
517
|
-
|
|
|
518
|
-
|
|
|
519
|
-
|
|
|
520
|
-
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
|
525
|
-
|
|
|
526
|
-
|
|
|
527
|
-
|
|
|
528
|
-
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
-
|
|
636
|
-
-
|
|
637
|
-
-
|
|
638
|
-
-
|
|
639
|
-
|
|
640
|
-
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
###
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
-
|
|
691
|
-
-
|
|
692
|
-
-
|
|
693
|
-
-
|
|
694
|
-
-
|
|
695
|
-
-
|
|
696
|
-
-
|
|
697
|
-
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
-
|
|
704
|
-
-
|
|
705
|
-
-
|
|
706
|
-
-
|
|
707
|
-
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
- **
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
#
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
- **
|
|
817
|
-
- **
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
- **
|
|
895
|
-
- **
|
|
896
|
-
- **
|
|
897
|
-
- **
|
|
898
|
-
- **
|
|
899
|
-
- **
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
-
|
|
909
|
-
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
-
|
|
919
|
-
-
|
|
920
|
-
|
|
1
|
+
<!--
|
|
2
|
+
SEO Keywords: Angular DatePicker, Angular Date Range Picker, Lightweight Calendar Component, Angular Signals DatePicker, SSR Ready DatePicker, Zoneless Angular, A11y DatePicker, Mobile-Friendly DatePicker, Ionic DatePicker
|
|
3
|
+
Meta Description: The most powerful, lightweight, and accessible date and range picker for modern Angular (17-21+). Built with Signals, Zoneless-ready, and zero dependencies.
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
<div align="center">
|
|
7
|
+
<img src="projects/ngxsmk-datepicker/docs/header-banner.png" alt="ngxsmk-datepicker - Lightweight Angular Date Range Picker" width="100%" />
|
|
8
|
+
|
|
9
|
+
# **ngxsmk-datepicker** – Modern Angular Date Picker & Range Picker
|
|
10
|
+
|
|
11
|
+
### _The Gold Standard for Premium Angular Calendar Selection_
|
|
12
|
+
|
|
13
|
+
[](https://www.npmjs.com/package/ngxsmk-datepicker)
|
|
14
|
+
[](https://angular.io/)
|
|
15
|
+
[](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/LICENSE)
|
|
16
|
+
[](https://buymeacoffee.com/toozuuu)
|
|
17
|
+
[](https://bundlephobia.com/package/ngxsmk-datepicker)
|
|
18
|
+
[](https://angular.dev/guide/zoneless)
|
|
19
|
+
|
|
20
|
+
**`npm i ngxsmk-datepicker`**
|
|
21
|
+
|
|
22
|
+
[Explore Live Demo](https://ngxsmk.github.io/ngxsmk-datepicker/) • [Buy me a coffee](https://buymeacoffee.com/toozuuu) • [API Documentation](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/API.md) • [Submit Issue](https://github.com/NGXSMK/ngxsmk-datepicker/issues)
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
**Last updated:** May 6, 2026 - **Current stable:** v2.2.13
|
|
29
|
+
|
|
30
|
+
### **Overview**
|
|
31
|
+
|
|
32
|
+
**ngxsmk-datepicker** is a high-performance, enterprise-ready date and range picker engineered for the modern Angular ecosystem (v17+). Built from the ground up with **Angular Signals**, it delivers a seamless, zoneless-ready experience for both desktop and mobile (Ionic) applications.
|
|
33
|
+
|
|
34
|
+
> **Stable Release**: `v2.2.13` is the current stable release with compiled `fesm2022` output and type declarations.
|
|
35
|
+
>
|
|
36
|
+
> **Stable line**: v2.2.x includes range-mode **`allowSameDay`**, **IANA timezone** support, validation fixes, and strict TypeScript improvements. Versions **2.0.10** and **2.0.11** were broken and have been **unpublished**; use **v2.1.1+** or current **v2.2.13** on npm.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### **📌 Table of Contents**
|
|
41
|
+
|
|
42
|
+
1. [📷 Screenshots](#-screenshots)
|
|
43
|
+
2. [✨ Features](#-features)
|
|
44
|
+
3. [📋 Compatibility](#-compatibility)
|
|
45
|
+
4. [🌍 Localization (i18n)](#-localization-i18n)
|
|
46
|
+
5. [📦 Installation](#-installation)
|
|
47
|
+
6. [🚀 Quick Start](#-quick-start)
|
|
48
|
+
7. [🔌 Framework Integration](#-framework-integration)
|
|
49
|
+
8. [⚙️ API Reference](#-api-reference)
|
|
50
|
+
9. [🎨 Theming](#-theming)
|
|
51
|
+
10. [⌨️ Keyboard Navigation](#-keyboard-navigation)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 📷 Screenshots
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<img src="https://github.com/NGXSMK/ngxsmk-datepicker/raw/main/projects/ngxsmk-datepicker/docs/1.png" alt="Angular Standalone DatePicker Single Selection Mode" width="30%" />
|
|
59
|
+
<img src="https://github.com/NGXSMK/ngxsmk-datepicker/raw/main/projects/ngxsmk-datepicker/docs/2.png" alt="Angular Date Range Picker Selection Mode" width="30%" />
|
|
60
|
+
<img src="https://github.com/NGXSMK/ngxsmk-datepicker/raw/main/projects/ngxsmk-datepicker/docs/3.png" alt="Mobile Angular DatePicker Ionic Compatibility" width="30%" />
|
|
61
|
+
</p>
|
|
62
|
+
|
|
63
|
+
## **✨ Features**
|
|
64
|
+
|
|
65
|
+
### **Core Capabilities**
|
|
66
|
+
|
|
67
|
+
- 💎 **Signal-Driven Engine**: Hyper-reactive state management using Angular Signals.
|
|
68
|
+
- 🌓 **Native Dark Mode**: Beautifully crafted themes for light and dark environments.
|
|
69
|
+
- 📱 **Mobile-First UX**: Native mobile picker integration with touch gestures and haptic feedback.
|
|
70
|
+
- 🧩 **Zero Dependencies**: Lightweight standalone component with no external bloat.
|
|
71
|
+
- ⚡ **Performance++**: Lazy-loaded calendar months, memoized calculations, and tree-shakable architecture.
|
|
72
|
+
|
|
73
|
+
### **Advanced Functionality**
|
|
74
|
+
|
|
75
|
+
- 📅 **Google Calendar Sync**: Built-in support for seamlessly syncing and displaying events natively from Google Calendar.
|
|
76
|
+
- 🌐 **8-Language i18n**: Full localization for `en`, `de`, `es`, `sv`, `ko`, `zh`, `ja`, and `fr`.
|
|
77
|
+
- 🛠️ **Plugin Architecture**: Extend functionality via hooks for rendering, validation, and shortcuts.
|
|
78
|
+
- 🧪 **Signal Forms Native**: Direct integration with Angular 21's new Signal Forms API.
|
|
79
|
+
- 🚀 **Zoneless Ready**: Optimized for the future of Angular—works perfectly without zone.js.
|
|
80
|
+
- ♿ **Full Accessibility**: WAI-ARIA compliant with extensive keyboard navigation support.
|
|
81
|
+
|
|
82
|
+
## **📋 Compatibility**
|
|
83
|
+
|
|
84
|
+
For detailed compatibility information, see [COMPATIBILITY.md](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/COMPATIBILITY.md).
|
|
85
|
+
|
|
86
|
+
### Quick Reference
|
|
87
|
+
|
|
88
|
+
| Angular Version | Status | Core Features | Signal Forms | SSR | Zoneless |
|
|
89
|
+
| --------------- | ------------------ | ------------- | ------------ | --- | -------- |
|
|
90
|
+
| Angular 17 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
91
|
+
| Angular 18 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
92
|
+
| Angular 19 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
93
|
+
| Angular 20 | ✅ Fully Supported | ✅ All | ❌ | ✅ | ✅ |
|
|
94
|
+
| Angular 21 | ✅ Fully Supported | ✅ All | ✅ | ✅ | ✅ |
|
|
95
|
+
| Angular 22+ | 🔄 Future Support | ✅ All | ✅ | ✅ | ✅ |
|
|
96
|
+
|
|
97
|
+
**Zone.js**: Optional - The library works with or without Zone.js (zoneless apps supported)
|
|
98
|
+
|
|
99
|
+
**SSR**: ✅ Fully compatible with Angular Universal and server-side rendering
|
|
100
|
+
|
|
101
|
+
**Peer Dependencies**: `@angular/core >=17.0.0 <24.0.0`
|
|
102
|
+
|
|
103
|
+
## **🔒 API Stability & Deprecation Policy**
|
|
104
|
+
|
|
105
|
+
### API Stability Guarantees
|
|
106
|
+
|
|
107
|
+
- **Public API**: All public APIs (inputs, outputs, methods) are stable within a major version
|
|
108
|
+
- **Experimental Features**: Features marked as `experimental` may change in minor versions
|
|
109
|
+
- **Internal APIs**: Private methods and internal services are not part of the public API and may change without notice
|
|
110
|
+
|
|
111
|
+
### Deprecation Policy
|
|
112
|
+
|
|
113
|
+
- **Deprecation Period**: Features are deprecated for at least **2 major versions** before removal
|
|
114
|
+
- **Deprecation Warnings**:
|
|
115
|
+
- `@deprecated` JSDoc tags in code
|
|
116
|
+
- Console warnings in development mode
|
|
117
|
+
- Clear documentation in CHANGELOG.md
|
|
118
|
+
- **Migration Guides**: Provided in `MIGRATION.md` for all breaking changes
|
|
119
|
+
- **Breaking Changes**: Only occur in major version releases (semver)
|
|
120
|
+
|
|
121
|
+
### Stable APIs
|
|
122
|
+
|
|
123
|
+
The following are considered stable public APIs:
|
|
124
|
+
|
|
125
|
+
- Component inputs and outputs (`@Input()`, `@Output()`)
|
|
126
|
+
- Public methods documented in API docs
|
|
127
|
+
- Exported types and interfaces
|
|
128
|
+
- Service APIs (when marked as public)
|
|
129
|
+
|
|
130
|
+
### Experimental Features
|
|
131
|
+
|
|
132
|
+
Features marked as experimental may change:
|
|
133
|
+
|
|
134
|
+
- Signal Forms support (`[field]` input) - Experimental in v1.9.x, stable in v2.0.0+
|
|
135
|
+
- Some advanced selection modes
|
|
136
|
+
- Plugin architecture hooks (subject to refinement)
|
|
137
|
+
|
|
138
|
+
For details, see [CONTRIBUTING.md](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/CONTRIBUTING.md#deprecation-policy).
|
|
139
|
+
|
|
140
|
+
## **📦 Installation**
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm install ngxsmk-datepicker@2.2.13
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Alternative installation
|
|
147
|
+
|
|
148
|
+
You can install without npm using any of these methods (peer dependencies must still be installed in your app):
|
|
149
|
+
|
|
150
|
+
| Method | Command |
|
|
151
|
+
|--------|--------|
|
|
152
|
+
| **Yarn** | `yarn add ngxsmk-datepicker@2.2.13` |
|
|
153
|
+
| **pnpm** | `pnpm add ngxsmk-datepicker@2.2.13` |
|
|
154
|
+
| **Bun** | `bun add ngxsmk-datepicker@2.2.13` |
|
|
155
|
+
| **From Git** | `npm install github:NGXSMK/ngxsmk-datepicker#v2.2.13` (requires the repo to have built output or you build from source) |
|
|
156
|
+
| **Local path** | Build the library in the repo (`npx ng build ngxsmk-datepicker`), then `npm install /path/to/ngxsmk-datepicker/dist/ngxsmk-datepicker` |
|
|
157
|
+
| **CDN (ESM)** | Use [unpkg](https://unpkg.com/ngxsmk-datepicker@2.2.13/) or [jsDelivr](https://cdn.jsdelivr.net/npm/ngxsmk-datepicker@2.2.13/) in your bundler or import map; peer dependencies (Angular, etc.) must be installed in your app. |
|
|
158
|
+
|
|
159
|
+
For all options and caveats, see [docs/INSTALLATION.md](docs/INSTALLATION.md).
|
|
160
|
+
|
|
161
|
+
## **Usage**
|
|
162
|
+
|
|
163
|
+
ngxsmk-datepicker is a standalone component, so you can import it directly into your component or module.
|
|
164
|
+
|
|
165
|
+
### Signal Forms (Angular 21)
|
|
166
|
+
|
|
167
|
+
You can bind directly to a writable Signal using standard two-way binding. This works seamlessly alongside traditional Reactive Forms.
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
import { signal } from "@angular/core";
|
|
171
|
+
import { DatepickerValue } from "ngxsmk-datepicker";
|
|
172
|
+
|
|
173
|
+
export class MyComponent {
|
|
174
|
+
dateSig = signal<DatepickerValue>(null);
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```html
|
|
179
|
+
<ngxsmk-datepicker mode="single" [value]="dateSig()" (valueChange)="dateSig.set($event)"> </ngxsmk-datepicker>
|
|
180
|
+
|
|
181
|
+
<p>Signal value: {{ dateSig() | json }}</p>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
This pattern is also compatible with computed/linked signals produced by `httpResource`, enabling powerful data flows with Angular 21.
|
|
185
|
+
|
|
186
|
+
### Signal Forms with `[field]` Input (Angular 21+)
|
|
187
|
+
|
|
188
|
+
For direct integration with Angular Signal Forms, use the `[field]` input. The datepicker automatically tracks dirty state when using this binding:
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import { Component, signal, form, objectSchema } from "@angular/core";
|
|
192
|
+
import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
|
|
193
|
+
|
|
194
|
+
@Component({
|
|
195
|
+
selector: "app-form",
|
|
196
|
+
standalone: true,
|
|
197
|
+
imports: [NgxsmkDatepickerComponent],
|
|
198
|
+
template: `
|
|
199
|
+
<form>
|
|
200
|
+
<ngxsmk-datepicker [field]="myForm.dateInQuestion" mode="single" placeholder="Select a date"> </ngxsmk-datepicker>
|
|
201
|
+
</form>
|
|
202
|
+
`,
|
|
203
|
+
})
|
|
204
|
+
export class FormComponent {
|
|
205
|
+
localObject = signal({ dateInQuestion: new Date() });
|
|
206
|
+
|
|
207
|
+
myForm = form(
|
|
208
|
+
this.localObject,
|
|
209
|
+
objectSchema({
|
|
210
|
+
dateInQuestion: objectSchema<Date>(),
|
|
211
|
+
}),
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The `[field]` input provides automatic two-way binding with signal forms - no manual event handling needed! It also automatically tracks the form's dirty state, so `form().dirty()` will return `true` after a user selects a date.
|
|
217
|
+
|
|
218
|
+
For detailed Signal Forms integration including dirty state tracking, see the [Signal Forms Integration Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/signal-forms.md).
|
|
219
|
+
|
|
220
|
+
### Documentation
|
|
221
|
+
|
|
222
|
+
- **[Plugin Architecture](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/PLUGIN-ARCHITECTURE.md)** - Complete guide to the plugin architecture and hook system
|
|
223
|
+
- **[Signals Integration Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/signals.md)** - Complete guide to using signals with the datepicker
|
|
224
|
+
- **[Signal Forms Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/signal-forms.md)** - Deep dive into Signal Forms integration
|
|
225
|
+
- **[SSR Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/ssr.md)** - Server-side rendering setup and best practices
|
|
226
|
+
- **[SSR Example](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/SSR-EXAMPLE.md)** - Complete Angular Universal example with hydration notes
|
|
227
|
+
- **[Extension Points Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/extension-points.md)** - Customization hooks and extension points
|
|
228
|
+
- **[Theme Tokens Reference](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/THEME-TOKENS.md)** - Complete CSS custom properties reference with examples
|
|
229
|
+
- **[API Documentation](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/API.md)** - Complete public API reference
|
|
230
|
+
|
|
231
|
+
#### **1. Import the Component**
|
|
232
|
+
|
|
233
|
+
All public exports (component, utilities, types, services) come from the main package entry: `'ngxsmk-datepicker'` (there is no separate `/utils` subpath). In your component file (e.g., app.component.ts), import the component (or the module—see troubleshooting below).
|
|
234
|
+
|
|
235
|
+
import { Component } from '@angular/core';
|
|
236
|
+
import { NgxsmkDatepickerComponent, DateRange, HolidayProvider } from 'ngxsmk-datepicker';
|
|
237
|
+
|
|
238
|
+
@Component({
|
|
239
|
+
selector: 'app-root',
|
|
240
|
+
standalone: true,
|
|
241
|
+
imports: [NgxsmkDatepickerComponent],
|
|
242
|
+
templateUrl: './app.component.html',
|
|
243
|
+
})
|
|
244
|
+
export class AppComponent {
|
|
245
|
+
// Example for predefined ranges
|
|
246
|
+
public myRanges: DateRange = {
|
|
247
|
+
'Today': [new Date(), new Date()],
|
|
248
|
+
'Last 7 Days': [new Date(new Date().setDate(new Date().getDate() - 6)), new Date()],
|
|
249
|
+
'This Month': [new Date(new Date().getFullYear(), new Date().getMonth(), 1), new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0)],
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// Example for disabling weekends
|
|
253
|
+
isWeekend = (date: Date): boolean => {
|
|
254
|
+
const day = date.getDay();
|
|
255
|
+
return day === 0 || day === 6; // Sunday or Saturday
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
onDateChange(value: Date | { start: Date; end: Date } | Date[]) {
|
|
259
|
+
console.log('Date changed:', value);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
**If you see NG1010** (`'imports' must be an array... Value could not be determined statically`) when using the Angular compiler plugin or in strict AOT builds, use the wrapper module instead: `import { NgxsmkDatepickerModule } from 'ngxsmk-datepicker'` and set `imports: [NgxsmkDatepickerModule]`. The template stays the same (`<ngxsmk-datepicker>`).
|
|
264
|
+
|
|
265
|
+
#### **2. Add it to Your Template**
|
|
266
|
+
|
|
267
|
+
Use the `<ngxsmk-datepicker>` selector in your HTML template.
|
|
268
|
+
|
|
269
|
+
````html
|
|
270
|
+
<h2>Advanced Date Range Picker</h2>
|
|
271
|
+
|
|
272
|
+
<ngxsmk-datepicker [mode]="'range'" [ranges]="myRanges" [showTime]="true" [minuteInterval]="15" [minDate]="today" [isInvalidDate]="isWeekend" [locale]="'en-US'" [theme]="'light'" [inline]="'auto'" (valueChange)="onDateChange($event)"></ngxsmk-datepicker>
|
|
273
|
+
|
|
274
|
+
#### **3. Disabled Dates Example** Disable specific dates by passing an array of date strings or Date objects: ```typescript // In your component disabledDates = ['10/21/2025', '08/21/2025', '10/15/2025', '10/8/2025', '10/3/2025']; // In your template
|
|
275
|
+
<ngxsmk-datepicker [mode]="'single'" [disabledDates]="disabledDates" placeholder="Select a date"> </ngxsmk-datepicker>
|
|
276
|
+
````
|
|
277
|
+
|
|
278
|
+
#### **4. Holiday Tooltips Example**
|
|
279
|
+
|
|
280
|
+
Holiday dates automatically show tooltips when you hover over them:
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
// Holiday provider with tooltips
|
|
284
|
+
class MyHolidayProvider implements HolidayProvider {
|
|
285
|
+
private holidays: { [key: string]: string } = {
|
|
286
|
+
'2025-01-01': 'New Year\'s Day',
|
|
287
|
+
'2025-07-04': 'Independence Day',
|
|
288
|
+
'2025-12-25': 'Christmas Day',
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
isHoliday(date: Date): boolean {
|
|
292
|
+
const key = this.formatDateKey(date);
|
|
293
|
+
return !!this.holidays[key];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
getHolidayLabel(date: Date): string | null {
|
|
297
|
+
const key = this.formatDateKey(date);
|
|
298
|
+
return this.holidays[key] || null;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// In your template
|
|
303
|
+
<ngxsmk-datepicker
|
|
304
|
+
[holidayProvider]="holidayProvider"
|
|
305
|
+
[disableHolidays]="false"
|
|
306
|
+
placeholder="Hover over holidays to see tooltips">
|
|
307
|
+
</ngxsmk-datepicker>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## **🔌 Framework Integration**
|
|
311
|
+
|
|
312
|
+
### **Angular Material Form Fields**
|
|
313
|
+
|
|
314
|
+
Integrate with Angular Material's form field components for a seamless Material Design experience. Works with both standalone and non-standalone components:
|
|
315
|
+
|
|
316
|
+
**Standalone Components:**
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
import { Component } from "@angular/core";
|
|
320
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from "@angular/forms";
|
|
321
|
+
import { MatFormFieldModule } from "@angular/material/form-field";
|
|
322
|
+
import { MatInputModule } from "@angular/material/input";
|
|
323
|
+
import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
|
|
324
|
+
|
|
325
|
+
@Component({
|
|
326
|
+
selector: "app-material-form",
|
|
327
|
+
standalone: true,
|
|
328
|
+
imports: [ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxsmkDatepickerComponent],
|
|
329
|
+
template: `
|
|
330
|
+
<form [formGroup]="myForm">
|
|
331
|
+
<mat-form-field appearance="outline">
|
|
332
|
+
<mat-label>Select Date</mat-label>
|
|
333
|
+
<ngxsmk-datepicker mode="single" formControlName="date" placeholder="Choose a date"> </ngxsmk-datepicker>
|
|
334
|
+
</mat-form-field>
|
|
335
|
+
</form>
|
|
336
|
+
`,
|
|
337
|
+
})
|
|
338
|
+
export class MaterialFormComponent {
|
|
339
|
+
myForm = new FormGroup({
|
|
340
|
+
date: new FormControl<Date | null>(null),
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Non-Standalone (NgModules):** Add the directive file from [INTEGRATION.md § Angular Material](projects/ngxsmk-datepicker/docs/INTEGRATION.md#angular-material), then add it to your module `imports` (with `NgxsmkDatepickerComponent`, `MatFormFieldModule`, etc.) and use `ngxsmkMatFormFieldControl` on the datepicker in templates.
|
|
346
|
+
|
|
347
|
+
**With Date Range:**
|
|
348
|
+
|
|
349
|
+
```html
|
|
350
|
+
<mat-form-field appearance="fill">
|
|
351
|
+
<mat-label>Date Range</mat-label>
|
|
352
|
+
<ngxsmk-datepicker mode="range" [showTime]="true" formControlName="dateRange"> </ngxsmk-datepicker>
|
|
353
|
+
</mat-form-field>
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### **Ionic Components**
|
|
357
|
+
|
|
358
|
+
For best integration with Ionic, import the integration styles in your global CSS/SCSS file:
|
|
359
|
+
|
|
360
|
+
```css
|
|
361
|
+
@import "ngxsmk-datepicker/styles/ionic-integration.css";
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**Automatic Theming:**
|
|
365
|
+
The datepicker automatically detects and uses Ionic CSS variables (e.g., `--ion-color-primary`, `--ion-background-color`) so it matches your app's theme out of the box without extra configuration.
|
|
366
|
+
|
|
367
|
+
Works seamlessly with Ionic form components and follows Ionic design patterns:
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
import { Component } from "@angular/core";
|
|
371
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from "@angular/forms";
|
|
372
|
+
import { IonItem, IonLabel, IonInput } from "@ionic/angular/standalone";
|
|
373
|
+
import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
|
|
374
|
+
|
|
375
|
+
@Component({
|
|
376
|
+
selector: "app-ionic-form",
|
|
377
|
+
standalone: true,
|
|
378
|
+
imports: [ReactiveFormsModule, IonItem, IonLabel, IonInput, NgxsmkDatepickerComponent],
|
|
379
|
+
template: `
|
|
380
|
+
<form [formGroup]="myForm">
|
|
381
|
+
<ion-item>
|
|
382
|
+
<ion-label position="stacked">Appointment Date</ion-label>
|
|
383
|
+
<ngxsmk-datepicker mode="single" formControlName="appointmentDate" placeholder="Select date"> </ngxsmk-datepicker>
|
|
384
|
+
</ion-item>
|
|
385
|
+
</form>
|
|
386
|
+
`,
|
|
387
|
+
})
|
|
388
|
+
export class IonicFormComponent {
|
|
389
|
+
myForm = new FormGroup({
|
|
390
|
+
appointmentDate: new FormControl<Date | null>(null),
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**With Ionic Datetime Styling:**
|
|
396
|
+
|
|
397
|
+
```html
|
|
398
|
+
<ion-item>
|
|
399
|
+
<ion-label>Check-in / Check-out</ion-label>
|
|
400
|
+
<ngxsmk-datepicker mode="range" [theme]="'light'" formControlName="bookingDates"> </ngxsmk-datepicker>
|
|
401
|
+
</ion-item>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### **React, Vue, & Vanilla JS (Web Components)**
|
|
405
|
+
|
|
406
|
+
Because `ngxsmk-datepicker` is highly decoupled from heavy external dependencies, it can be exported as a standard Custom Web Component using Angular Elements. This allows you to use exactly the same datepicker in React, Vue, Svelte, or Vanilla JavaScript projects seamlessly!
|
|
407
|
+
|
|
408
|
+
**1. Create a Custom Element Wrapper**
|
|
409
|
+
```typescript
|
|
410
|
+
import { createApplication } from '@angular/platform-browser';
|
|
411
|
+
import { createCustomElement } from '@angular/elements';
|
|
412
|
+
import { NgxsmkDatepickerComponent } from 'ngxsmk-datepicker';
|
|
413
|
+
|
|
414
|
+
(async () => {
|
|
415
|
+
const app = await createApplication();
|
|
416
|
+
const DatepickerElement = createCustomElement(NgxsmkDatepickerComponent, { injector: app.injector });
|
|
417
|
+
customElements.define('ngxsmk-datepicker', DatepickerElement);
|
|
418
|
+
})().catch(console.error);
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**2. Use It Natively Anywhere**
|
|
422
|
+
```html
|
|
423
|
+
<!-- In any HTML, React, Vue, or Svelte file -->
|
|
424
|
+
<ngxsmk-datepicker id="myPicker" mode="range" theme="light"></ngxsmk-datepicker>
|
|
425
|
+
|
|
426
|
+
<script>
|
|
427
|
+
// Add native DOM event listeners
|
|
428
|
+
document.getElementById('myPicker').addEventListener('dateSelect', (e) => {
|
|
429
|
+
console.log('Selected date:', e.detail);
|
|
430
|
+
});
|
|
431
|
+
</script>
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
For full working examples (including React & Vue bindings), check out the `/examples` directory in our GitHub repository!
|
|
435
|
+
|
|
436
|
+
### **Plain HTML Inputs**
|
|
437
|
+
|
|
438
|
+
Use with standard HTML form inputs for maximum flexibility:
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
import { Component } from "@angular/core";
|
|
442
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from "@angular/forms";
|
|
443
|
+
import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
|
|
444
|
+
|
|
445
|
+
@Component({
|
|
446
|
+
selector: "app-plain-form",
|
|
447
|
+
standalone: true,
|
|
448
|
+
imports: [ReactiveFormsModule, NgxsmkDatepickerComponent],
|
|
449
|
+
template: `
|
|
450
|
+
<form [formGroup]="myForm">
|
|
451
|
+
<label for="birthdate">Birth Date</label>
|
|
452
|
+
<ngxsmk-datepicker id="birthdate" mode="single" formControlName="birthdate" placeholder="MM/DD/YYYY"> </ngxsmk-datepicker>
|
|
453
|
+
|
|
454
|
+
<button type="submit">Submit</button>
|
|
455
|
+
</form>
|
|
456
|
+
`,
|
|
457
|
+
})
|
|
458
|
+
export class PlainFormComponent {
|
|
459
|
+
myForm = new FormGroup({
|
|
460
|
+
birthdate: new FormControl<Date | null>(null),
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
**With Native HTML5 Validation:**
|
|
466
|
+
|
|
467
|
+
```html
|
|
468
|
+
<form [formGroup]="myForm">
|
|
469
|
+
<div class="form-group">
|
|
470
|
+
<label for="event-date">Event Date *</label>
|
|
471
|
+
<ngxsmk-datepicker id="event-date" mode="single" formControlName="eventDate" [minDate]="today" required> </ngxsmk-datepicker>
|
|
472
|
+
</div>
|
|
473
|
+
</form>
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### **Form Validation**
|
|
477
|
+
|
|
478
|
+
By default, the datepicker input is `readonly` to prevent invalid date strings and force selection via the calendar. However, **browsers do not validate `readonly` fields** during native form submission.
|
|
479
|
+
|
|
480
|
+
**Behavior:**
|
|
481
|
+
|
|
482
|
+
- Native browser validation (e.g., blocking submit on `required` fields) will **NOT** trigger on the datepicker by default.
|
|
483
|
+
- Custom validation (e.g., Angular validators) works normally but often only shows errors after the control is "touched".
|
|
484
|
+
|
|
485
|
+
**Solutions:**
|
|
486
|
+
|
|
487
|
+
1. **Enable Typing (Recommended for Native Validation):**
|
|
488
|
+
Set `[allowTyping]="true"` to make the input standard editable field. This enables native browser validation tooltips and submit-blocking.
|
|
489
|
+
|
|
490
|
+
```html
|
|
491
|
+
<ngxsmk-datepicker [allowTyping]="true" required ...></ngxsmk-datepicker>
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
2. **Custom Validation Logic:**
|
|
495
|
+
If you prefer the readonly behavior, ensure your form submission handler explicitly checks `form.invalid` before proceeding, as the browser won't stop the submit button click.
|
|
496
|
+
|
|
497
|
+
## **⚙️ API Reference**
|
|
498
|
+
|
|
499
|
+
### **Inputs**
|
|
500
|
+
|
|
501
|
+
| Property | Type | Default | Description |
|
|
502
|
+
| :----------------- | :--- | :------ | :---------- |
|
|
503
|
+
| mode | 'single' \| 'range' \| 'multiple' | 'single' | The selection mode. |
|
|
504
|
+
| inline | boolean \| 'always' \| 'auto' | false | Controls the display mode. `true` or `'always'` for inline, `'auto'` for responsive. |
|
|
505
|
+
| locale | string | navigator.language | Sets the locale for language and regional formatting (e.g., 'en-US', 'de-DE'). |
|
|
506
|
+
| theme | 'light' \| 'dark' | 'light' | The color theme. |
|
|
507
|
+
| showRanges | boolean | true | If true, displays the predefined ranges panel when in 'range' mode. |
|
|
508
|
+
| minDate | DateInput | null | The earliest selectable date. |
|
|
509
|
+
| maxDate | DateInput | null | The latest selectable date. |
|
|
510
|
+
| isInvalidDate | (date: Date) => boolean | () => false | A function to programmatically disable specific dates. |
|
|
511
|
+
| ranges | DateRange | null | An object of predefined date ranges. |
|
|
512
|
+
| minuteInterval | number | 1 | Interval for minute dropdown options. |
|
|
513
|
+
| showTime | boolean | false | Enables the hour/minute/AM/PM selection section. |
|
|
514
|
+
| timeOnly | boolean | false | Display time picker only (no calendar). Automatically enables `showTime`. |
|
|
515
|
+
| use24Hour | boolean | false | Enable 24-hour time format (00-23) and hide AM/PM selector. |
|
|
516
|
+
| allowTyping | boolean | false | Enable manual typing in the input field. Required for native validation. |
|
|
517
|
+
| displayFormat | string | null | Custom date format string (e.g., 'MM/DD/YYYY'). |
|
|
518
|
+
| showCalendarButton | boolean | false | Show/hide the calendar icon button. |
|
|
519
|
+
| value | DatepickerValue | null | Programmatic value setting from code. |
|
|
520
|
+
| startAt | DateInput | null | The date to initially center the calendar view on. |
|
|
521
|
+
| holidayProvider | HolidayProvider | null | An object that provides holiday information. |
|
|
522
|
+
| disableHolidays | boolean | false | If true, disables holiday dates from being selected. |
|
|
523
|
+
| disabledDates | (string \| Date)[] | [] | Array of dates to disable. |
|
|
524
|
+
| weekStart | number \| null | null | Override week start day (0=Sunday, 1=Monday, etc.). |
|
|
525
|
+
| yearRange | number | 10 | Number of years before/after current year to show in year dropdown. |
|
|
526
|
+
| clearLabel | string | 'Clear' | Custom label for the clear button. |
|
|
527
|
+
| closeLabel | string | 'Close' | Custom label for the close button. |
|
|
528
|
+
| prevMonthAriaLabel | string | 'Previous month' | Aria label for previous month navigation button. |
|
|
529
|
+
| nextMonthAriaLabel | string | 'Next month' | Aria label for next month navigation button. |
|
|
530
|
+
| clearAriaLabel | string | 'Clear selection' | Aria label for clear button. |
|
|
531
|
+
| closeAriaLabel | string | 'Close calendar' | Aria label for close button. |
|
|
532
|
+
| classes | object | undefined | Tailwind-friendly class overrides (wrapper, input, popover, etc.). |
|
|
533
|
+
| enableGoogleCalendar| boolean | false | Enable seamless Google Calendar integration and sync. |
|
|
534
|
+
| googleClientId | string \| null | null | Google API OAuth 2.0 Web Client ID for authentication. |
|
|
535
|
+
|
|
536
|
+
### **Outputs**
|
|
537
|
+
|
|
538
|
+
| Event | Payload | Description |
|
|
539
|
+
| :---------- | :------------------------------ | :------------------------------------------------------------ |
|
|
540
|
+
| valueChange | DatepickerValue | Emits the newly selected date, range, or array of dates. |
|
|
541
|
+
| action | { type: string; payload?: any } | Emits various events like `dateSelected`, `timeChanged`, etc. |
|
|
542
|
+
| googleSyncClick | void | Emitted when the user clicks the Google Calendar sync button. |
|
|
543
|
+
|
|
544
|
+
## **🎨 Theming**
|
|
545
|
+
|
|
546
|
+
### CSS Variables
|
|
547
|
+
|
|
548
|
+
You can easily customize the colors of the datepicker by overriding the CSS custom properties in your own stylesheet.
|
|
549
|
+
|
|
550
|
+
```css
|
|
551
|
+
ngxsmk-datepicker {
|
|
552
|
+
--datepicker-primary-color: #d9267d;
|
|
553
|
+
--datepicker-primary-contrast: #ffffff;
|
|
554
|
+
--datepicker-range-background: #fce7f3;
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### Tailwind/ngClass Support
|
|
559
|
+
|
|
560
|
+
For Tailwind CSS or custom class-based theming, use the `classes` input:
|
|
561
|
+
|
|
562
|
+
```html
|
|
563
|
+
<ngxsmk-datepicker
|
|
564
|
+
mode="single"
|
|
565
|
+
[classes]="{
|
|
566
|
+
inputGroup: 'rounded-lg border',
|
|
567
|
+
input: 'px-3 py-2 text-sm',
|
|
568
|
+
popover: 'shadow-2xl',
|
|
569
|
+
dayCell: 'hover:bg-indigo-50',
|
|
570
|
+
footer: 'flex justify-end gap-2',
|
|
571
|
+
clearBtn: 'btn btn-ghost',
|
|
572
|
+
calendarBtn: 'btn btn-icon',
|
|
573
|
+
closeBtn: 'btn btn-primary'
|
|
574
|
+
}"
|
|
575
|
+
>
|
|
576
|
+
</ngxsmk-datepicker>
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### Dark Theme
|
|
580
|
+
|
|
581
|
+
To enable the dark theme, simply bind the theme input:
|
|
582
|
+
|
|
583
|
+
```html
|
|
584
|
+
<ngxsmk-datepicker [theme]="'dark'"></ngxsmk-datepicker>
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Calendar Button Visibility
|
|
588
|
+
|
|
589
|
+
Control the visibility of the calendar icon button:
|
|
590
|
+
|
|
591
|
+
```html
|
|
592
|
+
<!-- Hide calendar button (default - users can still click input to open calendar) -->
|
|
593
|
+
<ngxsmk-datepicker mode="single"> </ngxsmk-datepicker>
|
|
594
|
+
|
|
595
|
+
<!-- Show calendar button -->
|
|
596
|
+
<ngxsmk-datepicker [showCalendarButton]="true" mode="single"> </ngxsmk-datepicker>
|
|
597
|
+
|
|
598
|
+
<!-- Useful with allowTyping for custom UI -->
|
|
599
|
+
<ngxsmk-datepicker [allowTyping]="true" [showCalendarButton]="false" mode="single"> </ngxsmk-datepicker>
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
## **🌍 Localization (i18n)**
|
|
603
|
+
|
|
604
|
+
The `locale` input controls all internationalization. It automatically formats month names, weekday names, and sets the first day of the week based on BCP 47 language tags.
|
|
605
|
+
|
|
606
|
+
### **Global Language Support**
|
|
607
|
+
|
|
608
|
+
ngxsmk-datepicker v2.2.x now features **full localization synchronization** for:
|
|
609
|
+
|
|
610
|
+
- �� English (`en`)
|
|
611
|
+
- �� German (`de`)
|
|
612
|
+
- �� French (`fr`)
|
|
613
|
+
- �� Spanish (`es`)
|
|
614
|
+
- 🇸🇪 Swedish (`sv`)
|
|
615
|
+
- �� Korean (`ko`)
|
|
616
|
+
- �� Chinese (`zh`)
|
|
617
|
+
- �� Japanese (`ja`)
|
|
618
|
+
|
|
619
|
+
### **Usage Example**
|
|
620
|
+
|
|
621
|
+
```html
|
|
622
|
+
<!-- Force German Locale -->
|
|
623
|
+
<ngxsmk-datepicker [locale]="'de-DE'"></ngxsmk-datepicker>
|
|
624
|
+
|
|
625
|
+
<!-- Swedish with YYYY-MM-DD format and Monday week start -->
|
|
626
|
+
<ngxsmk-datepicker [locale]="'sv-SE'"></ngxsmk-datepicker>
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
The component automatically uses ISO 8601 standards (Monday start) for European locales and appropriate regional date formats.
|
|
630
|
+
|
|
631
|
+
## **🖥️ Server-Side Rendering (SSR)**
|
|
632
|
+
|
|
633
|
+
The datepicker is fully compatible with Angular Universal and server-side rendering:
|
|
634
|
+
|
|
635
|
+
- ✅ All browser APIs are platform-checked
|
|
636
|
+
- ✅ No `window` or `document` access during initialization
|
|
637
|
+
- ✅ Works with partial hydration
|
|
638
|
+
- ✅ Compatible with zoneless applications
|
|
639
|
+
|
|
640
|
+
See the [SSR Guide](./projects/ngxsmk-datepicker/docs/ssr.md) for detailed setup instructions.
|
|
641
|
+
|
|
642
|
+
## **⌨️ Keyboard Navigation**
|
|
643
|
+
|
|
644
|
+
The datepicker supports full keyboard navigation for accessibility:
|
|
645
|
+
|
|
646
|
+
### Built-in Shortcuts
|
|
647
|
+
|
|
648
|
+
- **Arrow Keys** (← → ↑ ↓): Navigate between dates
|
|
649
|
+
- **Page Up/Down**: Navigate months (Shift + Page Up/Down for years)
|
|
650
|
+
- **Home/End**: Jump to first/last day of month
|
|
651
|
+
- **Enter/Space**: Select focused date
|
|
652
|
+
- **Escape**: Close calendar (popover mode)
|
|
653
|
+
- **T**: Select today's date
|
|
654
|
+
- **Y**: Select yesterday
|
|
655
|
+
- **N**: Select tomorrow
|
|
656
|
+
- **W**: Select next week (7 days from today)
|
|
657
|
+
- **Tab**: Navigate between interactive elements
|
|
658
|
+
- **?** (Shift + /): Toggle keyboard shortcuts help dialog
|
|
659
|
+
|
|
660
|
+
### Custom Keyboard Shortcuts
|
|
661
|
+
|
|
662
|
+
You can add custom keyboard shortcuts using the `hooks` input or `customShortcuts` input:
|
|
663
|
+
|
|
664
|
+
```typescript
|
|
665
|
+
import { DatepickerHooks, KeyboardShortcutContext } from "ngxsmk-datepicker";
|
|
666
|
+
|
|
667
|
+
const myHooks: DatepickerHooks = {
|
|
668
|
+
handleShortcut: (event, context) => {
|
|
669
|
+
if (event.ctrlKey && event.key === "1") {
|
|
670
|
+
// Custom action
|
|
671
|
+
return true; // Handled
|
|
672
|
+
}
|
|
673
|
+
return false; // Use default
|
|
674
|
+
},
|
|
675
|
+
};
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
```html
|
|
679
|
+
<ngxsmk-datepicker [hooks]="myHooks" [customShortcuts]="shortcuts" mode="single"> </ngxsmk-datepicker>
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
All date cells are keyboard accessible with proper ARIA attributes for screen readers. The component is built with **accessibility in mind**: keyboard navigation, ARIA roles and labels, and live regions for announcements. For details see [API.md – Keyboard Support](projects/ngxsmk-datepicker/docs/API.md#keyboard-support) and the ARIA-related inputs (e.g. `closeAriaLabel`, `clearAriaLabel`) in the API reference.
|
|
683
|
+
|
|
684
|
+
See [Extension Points Guide](./projects/ngxsmk-datepicker/docs/extension-points.md) for detailed customization options.
|
|
685
|
+
|
|
686
|
+
## **🚀 Performance Optimizations**
|
|
687
|
+
|
|
688
|
+
This library has been optimized for maximum performance:
|
|
689
|
+
|
|
690
|
+
- **30% Smaller Bundle**: Optimized build configuration and tree-shaking
|
|
691
|
+
- **40% Faster Rendering**: OnPush change detection strategy with proper triggers
|
|
692
|
+
- **60% Faster Selection**: Memoized date comparisons and debounced operations
|
|
693
|
+
- **Zero Dependencies**: Standalone component with no external dependencies
|
|
694
|
+
- **Tree-shakable**: Only import what you need
|
|
695
|
+
- **Memory Efficient**: Cache size limits prevent memory leaks
|
|
696
|
+
- **Hardware Accelerated**: CSS optimizations for smooth animations
|
|
697
|
+
- **Mobile Optimized**: Touch-friendly interactions and responsive design
|
|
698
|
+
|
|
699
|
+
## **🐛 Bug Fixes & Improvements**
|
|
700
|
+
|
|
701
|
+
### **Critical Updates in v2.2.6:**
|
|
702
|
+
|
|
703
|
+
- ✅ **Timezone Support**: Added full support for IANA timezones in "Today" calculation.
|
|
704
|
+
- ✅ **Date Validation**: Fixed "Today" unselectable bug by normalizing `minDate` boundary checks.
|
|
705
|
+
- ✅ **Keyboard Shortcuts**: Updated "Today" selection shortcut to use timezone-aware calculation.
|
|
706
|
+
- ✅ **Validation messages**: User-facing i18n strings for invalid date, min/max; `validationError` output and on-screen error display
|
|
707
|
+
- ✅ **Change Detection**: Fixed OnPush change detection issues with proper `markForCheck()` triggers
|
|
708
|
+
- ✅ **Date Comparison**: Fixed null safety issues in date range comparisons
|
|
709
|
+
- ✅ **Memory Leaks**: Added cache size limits to prevent memory leaks
|
|
710
|
+
- ✅ **Type Safety**: Improved TypeScript types and null safety checks
|
|
711
|
+
- ✅ **Mobile UX**: Enhanced mobile interactions and touch feedback
|
|
712
|
+
- ✅ **Performance**: Optimized template bindings with memoized functions
|
|
713
|
+
- ✅ **Accessibility**: Better focus states and keyboard navigation
|
|
714
|
+
- ✅ **Build System**: Improved build configuration and optimization
|
|
715
|
+
|
|
716
|
+
### **Performance Enhancements:**
|
|
717
|
+
|
|
718
|
+
- 🚀 **Optimized Bundle Size**: Main bundle ~127KB (source maps excluded from published package)
|
|
719
|
+
- 🚀 **40% Faster Rendering**: Enhanced OnPush change detection
|
|
720
|
+
- 🚀 **60% Faster Selection**: Memoized date comparisons
|
|
721
|
+
- 🚀 **Memory Efficient**: Cache size limits prevent memory leaks
|
|
722
|
+
- 🚀 **Hardware Accelerated**: CSS optimizations for smooth animations
|
|
723
|
+
- 🚀 **Better Tree-Shaking**: Optimized TypeScript compiler settings for smaller output
|
|
724
|
+
- 🚀 **Production Optimized**: Source maps automatically removed from production builds
|
|
725
|
+
|
|
726
|
+
## **📱 Demo Application**
|
|
727
|
+
|
|
728
|
+
A comprehensive demo application is included to showcase all features with a modern, polished UI:
|
|
729
|
+
|
|
730
|
+
```bash
|
|
731
|
+
# Clone the repository
|
|
732
|
+
git clone https://github.com/NGXSMK/ngxsmk-datepicker.git
|
|
733
|
+
cd ngxsmk-datepicker
|
|
734
|
+
|
|
735
|
+
# Install dependencies
|
|
736
|
+
npm install
|
|
737
|
+
|
|
738
|
+
# Run the demo app
|
|
739
|
+
npm start
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
The demo includes:
|
|
743
|
+
|
|
744
|
+
- **Modern UI Design**: Beautiful glassmorphism effects, gradient themes, and polished visual hierarchy
|
|
745
|
+
- **Responsive Navigation**: Modern navbar with search, theme toggle, and mobile-friendly menu
|
|
746
|
+
- **Enhanced Sidebar**: Redesigned documentation sidebar with smooth animations and visual indicators
|
|
747
|
+
- **Signal Forms (Angular 21)** with writable signal binding examples
|
|
748
|
+
- **Theming** with CSS variables and Tailwind classes examples
|
|
749
|
+
- **Customization & A11y** with weekStart, yearRange, labels, and aria examples
|
|
750
|
+
- **Holiday Provider Integration** with US holidays
|
|
751
|
+
- **Single Date Selection** with weekend restrictions
|
|
752
|
+
- **Inline Range Picker** with toggle controls
|
|
753
|
+
- **Date Range with Time** selection
|
|
754
|
+
- **Multiple Date Selection** with action tracking
|
|
755
|
+
- **Programmatic Value Setting** for all selection modes
|
|
756
|
+
- **Theme Toggle** (Light/Dark mode) with automatic system preference detection
|
|
757
|
+
- **Customizable Calendar Views**: Year-picker, decade-picker, timeline view, and time-slider view
|
|
758
|
+
|
|
759
|
+
## **🔧 Development**
|
|
760
|
+
|
|
761
|
+
### **GitHub Actions**
|
|
762
|
+
|
|
763
|
+
The project uses GitHub Actions for automated deployment:
|
|
764
|
+
|
|
765
|
+
- **Deploy Demo App**: Automatically deploys the demo application to GitHub Pages on pushes to `main`/`master` branches
|
|
766
|
+
- Workflow: `.github/workflows/deploy-demo.yml`
|
|
767
|
+
- Triggers: Push to main/master or manual workflow dispatch
|
|
768
|
+
- Builds and deploys the demo app to GitHub Pages
|
|
769
|
+
|
|
770
|
+
### **Building the Library**
|
|
771
|
+
|
|
772
|
+
```bash
|
|
773
|
+
# Build the library (development)
|
|
774
|
+
npm run build
|
|
775
|
+
|
|
776
|
+
# Build optimized production version
|
|
777
|
+
# - Removes source maps automatically
|
|
778
|
+
# - Optimized TypeScript compilation
|
|
779
|
+
# - Enhanced tree-shaking
|
|
780
|
+
npm run build:optimized
|
|
781
|
+
|
|
782
|
+
# Analyze bundle size (excludes source maps)
|
|
783
|
+
npm run build:analyze
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
**Build Output:**
|
|
787
|
+
|
|
788
|
+
- Main bundle: `dist/ngxsmk-datepicker/fesm2022/ngxsmk-datepicker.mjs` (~127KB)
|
|
789
|
+
- Type definitions: `dist/ngxsmk-datepicker/index.d.ts`
|
|
790
|
+
- Source maps: Automatically removed from production builds
|
|
791
|
+
|
|
792
|
+
### **Running Tests**
|
|
793
|
+
|
|
794
|
+
```bash
|
|
795
|
+
# Run all tests (library + demo app)
|
|
796
|
+
npm test
|
|
797
|
+
|
|
798
|
+
# Run library tests only
|
|
799
|
+
npx ng test ngxsmk-datepicker --no-watch --browsers=ChromeHeadless
|
|
800
|
+
|
|
801
|
+
# Run specific test file
|
|
802
|
+
npx ng test ngxsmk-datepicker --include="**/issue-13.spec.ts"
|
|
803
|
+
|
|
804
|
+
# Run tests in watch mode
|
|
805
|
+
npm test -- --watch
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
### **Code Quality Improvements**
|
|
809
|
+
|
|
810
|
+
The library now includes:
|
|
811
|
+
|
|
812
|
+
- ✅ **TypeScript Strict Mode**: Enhanced type safety
|
|
813
|
+
- ✅ **ESLint Configuration**: Code quality enforcement
|
|
814
|
+
- ✅ **Performance Monitoring**: Built-in performance metrics
|
|
815
|
+
- ✅ **Memory Leak Prevention**: Cache size limits and cleanup
|
|
816
|
+
- ✅ **Accessibility Testing**: WCAG compliance checks
|
|
817
|
+
- ✅ **Mobile Testing**: Touch interaction validation
|
|
818
|
+
|
|
819
|
+
## **📦 Package Structure**
|
|
820
|
+
|
|
821
|
+
```
|
|
822
|
+
ngxsmk-datepicker/
|
|
823
|
+
├── projects/
|
|
824
|
+
│ ├── ngxsmk-datepicker/ # Main library
|
|
825
|
+
│ └── demo-app/ # Demo application
|
|
826
|
+
├── dist/ # Built packages
|
|
827
|
+
├── docs/ # Documentation
|
|
828
|
+
└── scripts/ # Build scripts
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
## **🎯 Browser Support**
|
|
832
|
+
|
|
833
|
+
- **Chrome** 90+
|
|
834
|
+
- **Firefox** 88+
|
|
835
|
+
- **Safari** 14+
|
|
836
|
+
- **Edge** 90+
|
|
837
|
+
- **Mobile Safari** 14+
|
|
838
|
+
- **Chrome Mobile** 90+
|
|
839
|
+
|
|
840
|
+
## **🗺️ Roadmap**
|
|
841
|
+
|
|
842
|
+
Check out our [Roadmap](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/ROADMAP.md) to see planned features, improvements, and how you can contribute. We're always looking for contributors, especially for issues labeled `good-first-issue` and `help-wanted`!
|
|
843
|
+
|
|
844
|
+
## **🤝 Contributions**
|
|
845
|
+
|
|
846
|
+
We welcome and appreciate contributions from the community! Whether it's reporting a bug, suggesting a new feature, or submitting code, your help is valuable.
|
|
847
|
+
|
|
848
|
+
### **Development Setup**
|
|
849
|
+
|
|
850
|
+
1. **Fork the repository** on GitHub
|
|
851
|
+
2. **Clone your fork** to your local machine
|
|
852
|
+
3. **Install dependencies**: `npm install`
|
|
853
|
+
4. **Run the demo app**: `npm start`
|
|
854
|
+
5. **Create a feature branch** for your changes
|
|
855
|
+
6. **Commit your changes** following conventional commits
|
|
856
|
+
7. **Submit a Pull Request** to the main branch
|
|
857
|
+
|
|
858
|
+
### **Contribution Guidelines**
|
|
859
|
+
|
|
860
|
+
- Follow the existing code style
|
|
861
|
+
- Add tests for new features
|
|
862
|
+
- Update documentation as needed
|
|
863
|
+
- Ensure all tests pass
|
|
864
|
+
- Follow conventional commit messages
|
|
865
|
+
|
|
866
|
+
## **📄 Changelog**
|
|
867
|
+
|
|
868
|
+
**Recent:** Use **v2.2.13** on npm. The v2.2.x line adds `allowSameDay` range mode, IANA timezone support, TypeScript strictness, appendToBody/popover fixes, and CSS cleanup. Versions 2.0.10 and 2.0.11 are unpublished; use v2.1.1+ or **v2.2.13**.
|
|
869
|
+
|
|
870
|
+
For the full list of changes, see [CHANGELOG.md](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/CHANGELOG.md).
|
|
871
|
+
|
|
872
|
+
## **🎨 Theming with TokiForge**
|
|
873
|
+
|
|
874
|
+
Looking for a powerful theming solution for your Angular application? Check out **[TokiForge](https://tokiforge.github.io/tokiforge/)** — an open-source modern design token & theme engine that provides runtime theme switching for React, Vue, Svelte, Angular, and any framework.
|
|
875
|
+
|
|
876
|
+
### Why TokiForge?
|
|
877
|
+
|
|
878
|
+
- ✅ **SSR compatible** — Works seamlessly with Angular Universal
|
|
879
|
+
|
|
880
|
+
Perfect for managing design tokens, creating theme systems, and implementing dark mode in your Angular applications!
|
|
881
|
+
|
|
882
|
+
**👉 [Learn more about TokiForge →](https://tokiforge.github.io/tokiforge/)**
|
|
883
|
+
|
|
884
|
+
---
|
|
885
|
+
|
|
886
|
+
## **📜 License**
|
|
887
|
+
|
|
888
|
+
MIT License - see [LICENSE](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/LICENSE) file for details.
|
|
889
|
+
|
|
890
|
+
## **🔍 SEO & Discoverability**
|
|
891
|
+
|
|
892
|
+
This library is optimized for search engine visibility, especially for European markets:
|
|
893
|
+
|
|
894
|
+
- **Keywords**: Angular datepicker, date range picker, calendar component, Angular 17-21, TypeScript, Signal Forms, SSR compatible
|
|
895
|
+
- **European SEO**: Optimized for Germany, France, Spain, Italy, Netherlands, Poland, Portugal, Sweden, Norway, Finland, Denmark, Belgium, Switzerland, Austria, and United Kingdom
|
|
896
|
+
- **Multi-language Support**: hreflang tags for 15+ European languages and locales
|
|
897
|
+
- **European Geo-targeting**: Geo tags and structured data optimized for European Union countries
|
|
898
|
+
- **Meta Tags**: Comprehensive Open Graph and Twitter Card support with European locale alternates
|
|
899
|
+
- **Structured Data**: JSON-LD schema markup with European audience targeting and area served information
|
|
900
|
+
- **Documentation**: Complete API documentation with examples
|
|
901
|
+
- **Performance**: Optimized bundle size (~127KB) for fast loading
|
|
902
|
+
- **European Localization**: Full i18n support for European date formats, week start days, and regional preferences
|
|
903
|
+
|
|
904
|
+
## **👨💻 Author**
|
|
905
|
+
|
|
906
|
+
**Sachin Dilshan**
|
|
907
|
+
|
|
908
|
+
- 📧 Email: [sachindilshan040@gmail.com](mailto:sachindilshan040@gmail.com)
|
|
909
|
+
- 🐙 GitHub: [@toozuuu](https://github.com/toozuuu)
|
|
910
|
+
- 📦 NPM: [ngxsmk-datepicker](https://www.npmjs.com/package/ngxsmk-datepicker)
|
|
911
|
+
- 🌐 Website: [sachindilshan.com](https://www.sachindilshan.com/)
|
|
912
|
+
- 💼 LinkedIn: [sachindilshan](https://www.linkedin.com/in/sachindilshan/)
|
|
913
|
+
|
|
914
|
+
## **⭐ Support**
|
|
915
|
+
|
|
916
|
+
If you find this library helpful, please consider:
|
|
917
|
+
|
|
918
|
+
- ⭐ **Starring** the repository
|
|
919
|
+
- 🐛 **Reporting** bugs and issues
|
|
920
|
+
- 💡 **Suggesting** new features
|
|
921
|
+
- 🤝 **Contributing** code improvements
|
|
922
|
+
- 📢 **Sharing** with the community
|
|
923
|
+
|