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/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
- [![npm version](https://img.shields.io/npm/v/ngxsmk-datepicker.svg?style=flat-square&color=6d28d9)](https://www.npmjs.com/package/ngxsmk-datepicker)
14
- [![Angular](https://img.shields.io/badge/Angular-17%2B-DD0031.svg?style=flat-square&logo=angular)](https://angular.io/)
15
- [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/LICENSE)
16
- [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-toozuuu-orange?style=flat-square&logo=buy-me-a-coffee)](https://buymeacoffee.com/toozuuu)
17
- [![Bundle Size](https://img.shields.io/badge/bundle-~127KB-success.svg?style=flat-square)](https://bundlephobia.com/package/ngxsmk-datepicker)
18
- [![Zoneless](https://img.shields.io/badge/Zoneless-Ready-blueviolet.svg?style=flat-square)](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 2, 2026 · **Current stable:** v2.2.12
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.12` restores correct **npm** artifacts (compiled `fesm2022/` and types), adds range-mode **`allowSameDay`** for single-day selections, and continues to ship **IANA timezone** support, validation fixes, and strict TypeScript improvements from the v2.2.x line.
35
- >
36
- > ⚠️ **Important**: Versions 2.0.10 and 2.0.11 are broken and have been unpublished. Please use v2.2.12 or later.
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
- Install the package using npm:
143
-
144
- ```bash
145
- npm install ngxsmk-datepicker@latest
146
- ```
147
-
148
- ### Alternative installation
149
-
150
- You can install without npm using Yarn, pnpm, Bun, from Git, a local path, or via CDN (ESM). Peer dependencies must still be installed in your app. For all options and caveats, see [INSTALLATION.md](../../docs/INSTALLATION.md) in the repo root.
151
-
152
- ## **Usage**
153
-
154
- ngxsmk-datepicker is a standalone component, so you can import it directly into your component or module. 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 `NgxsmkDatepickerModule` in your `imports` array instead of `NgxsmkDatepickerComponent` (same template: `<ngxsmk-datepicker>`).
155
-
156
- ### Signal Forms (Angular 21)
157
-
158
- You can bind directly to a writable Signal using standard two-way binding. This works seamlessly alongside traditional Reactive Forms.
159
-
160
- ```ts
161
- import { signal } from "@angular/core";
162
- import { DatepickerValue } from "ngxsmk-datepicker";
163
-
164
- export class MyComponent {
165
- dateSig = signal<DatepickerValue>(null);
166
- }
167
- ```
168
-
169
- ```html
170
- <ngxsmk-datepicker mode="single" [value]="dateSig()" (valueChange)="dateSig.set($event)"> </ngxsmk-datepicker>
171
-
172
- <p>Signal value: {{ dateSig() | json }}</p>
173
- ```
174
-
175
- This pattern is also compatible with computed/linked signals produced by `httpResource`, enabling powerful data flows with Angular 21.
176
-
177
- ### Signal Forms with `[field]` Input (Angular 21+)
178
-
179
- For direct integration with Angular Signal Forms, use the `[field]` input. The datepicker automatically tracks dirty state when using this binding:
180
-
181
- ```typescript
182
- import { Component, signal, form, objectSchema } from "@angular/core";
183
- import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
184
-
185
- @Component({
186
- selector: "app-form",
187
- standalone: true,
188
- imports: [NgxsmkDatepickerComponent],
189
- template: `
190
- <form>
191
- <ngxsmk-datepicker [field]="myForm.dateInQuestion" mode="single" placeholder="Select a date"> </ngxsmk-datepicker>
192
- </form>
193
- `,
194
- })
195
- export class FormComponent {
196
- localObject = signal({ dateInQuestion: new Date() });
197
-
198
- myForm = form(
199
- this.localObject,
200
- objectSchema({
201
- dateInQuestion: objectSchema<Date>(),
202
- }),
203
- );
204
- }
205
- ```
206
-
207
- 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.
208
-
209
- 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).
210
-
211
- ### Documentation
212
-
213
- - **[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
214
- - **[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
215
- - **[Signal Forms Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/signal-forms.md)** - Deep dive into Signal Forms integration
216
- - **[SSR Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/ssr.md)** - Server-side rendering setup and best practices
217
- - **[SSR Example](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/SSR-EXAMPLE.md)** - Complete Angular Universal example with hydration notes
218
- - **[Extension Points Guide](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/extension-points.md)** - Customization hooks and extension points
219
- - **[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
220
- - **[API Documentation](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/projects/ngxsmk-datepicker/docs/API.md)** - Complete public API reference
221
-
222
- #### **1. Import the Component**
223
-
224
- In your component file (e.g., app.component.ts), import NgxsmkDatepickerComponent.
225
-
226
- import { Component } from '@angular/core';
227
- import { NgxsmkDatepickerComponent, DateRange, HolidayProvider } from 'ngxsmk-datepicker';
228
-
229
- @Component({
230
- selector: 'app-root',
231
- standalone: true,
232
- imports: [NgxsmkDatepickerComponent],
233
- templateUrl: './app.component.html',
234
- })
235
- export class AppComponent {
236
- // Example for predefined ranges
237
- public myRanges: DateRange = {
238
- 'Today': [new Date(), new Date()],
239
- 'Last 7 Days': [new Date(new Date().setDate(new Date().getDate() - 6)), new Date()],
240
- 'This Month': [new Date(new Date().getFullYear(), new Date().getMonth(), 1), new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0)],
241
- };
242
-
243
- // Example for disabling weekends
244
- isWeekend = (date: Date): boolean => {
245
- const day = date.getDay();
246
- return day === 0 || day === 6; // Sunday or Saturday
247
- };
248
-
249
- onDateChange(value: Date | { start: Date; end: Date } | Date[]) {
250
- console.log('Date changed:', value);
251
- }
252
- }
253
-
254
- #### **2. Add it to Your Template**
255
-
256
- Use the `<ngxsmk-datepicker>` selector in your HTML template.
257
-
258
- ````html
259
- <h2>Advanced Date Range Picker</h2>
260
-
261
- <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>
262
-
263
- #### **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
264
- <ngxsmk-datepicker [mode]="'single'" [disabledDates]="disabledDates" placeholder="Select a date"> </ngxsmk-datepicker>
265
- ````
266
-
267
- #### **4. Holiday Tooltips Example**
268
-
269
- Holiday dates automatically show tooltips when you hover over them:
270
-
271
- ```typescript
272
- // Holiday provider with tooltips
273
- class MyHolidayProvider implements HolidayProvider {
274
- private holidays: { [key: string]: string } = {
275
- '2025-01-01': 'New Year\'s Day',
276
- '2025-07-04': 'Independence Day',
277
- '2025-12-25': 'Christmas Day',
278
- };
279
-
280
- isHoliday(date: Date): boolean {
281
- const key = this.formatDateKey(date);
282
- return !!this.holidays[key];
283
- }
284
-
285
- getHolidayLabel(date: Date): string | null {
286
- const key = this.formatDateKey(date);
287
- return this.holidays[key] || null;
288
- }
289
- }
290
-
291
- // In your template
292
- <ngxsmk-datepicker
293
- [holidayProvider]="holidayProvider"
294
- [disableHolidays]="false"
295
- placeholder="Hover over holidays to see tooltips">
296
- </ngxsmk-datepicker>
297
- ```
298
-
299
- ## **🔌 Framework Integration**
300
-
301
- ### **Angular Material Form Fields**
302
-
303
- Integrate with Angular Material's form field components for a seamless Material Design experience. Works with both standalone and non-standalone components:
304
-
305
- **Standalone Components:**
306
-
307
- ```typescript
308
- import { Component } from "@angular/core";
309
- import { FormControl, FormGroup, ReactiveFormsModule } from "@angular/forms";
310
- import { MatFormFieldModule } from "@angular/material/form-field";
311
- import { MatInputModule } from "@angular/material/input";
312
- import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
313
-
314
- @Component({
315
- selector: "app-material-form",
316
- standalone: true,
317
- imports: [ReactiveFormsModule, MatFormFieldModule, MatInputModule, NgxsmkDatepickerComponent],
318
- template: `
319
- <form [formGroup]="myForm">
320
- <mat-form-field appearance="outline">
321
- <mat-label>Select Date</mat-label>
322
- <ngxsmk-datepicker mode="single" formControlName="date" placeholder="Choose a date"> </ngxsmk-datepicker>
323
- </mat-form-field>
324
- </form>
325
- `,
326
- })
327
- export class MaterialFormComponent {
328
- myForm = new FormGroup({
329
- date: new FormControl<Date | null>(null),
330
- });
331
- }
332
- ```
333
-
334
- **Non-Standalone (NgModules):** Add the directive file from [INTEGRATION.md § Angular Material](docs/INTEGRATION.md#angular-material), then add it to your module `imports` (with `NgxsmkDatepickerComponent`, `MatFormFieldModule`, etc.) and use `ngxsmkMatFormFieldControl` on the datepicker in templates.
335
-
336
- **With Date Range:**
337
-
338
- ```html
339
- <mat-form-field appearance="fill">
340
- <mat-label>Date Range</mat-label>
341
- <ngxsmk-datepicker mode="range" [showTime]="true" formControlName="dateRange"> </ngxsmk-datepicker>
342
- </mat-form-field>
343
- ```
344
-
345
- ### **Ionic Components**
346
-
347
- For best integration with Ionic, import the integration styles in your global CSS/SCSS file:
348
-
349
- ```css
350
- @import "ngxsmk-datepicker/styles/ionic-integration.css";
351
- ```
352
-
353
- Works seamlessly with Ionic form components and follows Ionic design patterns:
354
-
355
- ```typescript
356
- import { Component } from "@angular/core";
357
- import { FormControl, FormGroup, ReactiveFormsModule } from "@angular/forms";
358
- import { IonItem, IonLabel, IonInput } from "@ionic/angular/standalone";
359
- import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
360
-
361
- @Component({
362
- selector: "app-ionic-form",
363
- standalone: true,
364
- imports: [ReactiveFormsModule, IonItem, IonLabel, IonInput, NgxsmkDatepickerComponent],
365
- template: `
366
- <form [formGroup]="myForm">
367
- <ion-item>
368
- <ion-label position="stacked">Appointment Date</ion-label>
369
- <ngxsmk-datepicker mode="single" formControlName="appointmentDate" placeholder="Select date"> </ngxsmk-datepicker>
370
- </ion-item>
371
- </form>
372
- `,
373
- })
374
- export class IonicFormComponent {
375
- myForm = new FormGroup({
376
- appointmentDate: new FormControl<Date | null>(null),
377
- });
378
- }
379
- ```
380
-
381
- **With Ionic Datetime Styling:**
382
-
383
- ```html
384
- <ion-item>
385
- <ion-label>Check-in / Check-out</ion-label>
386
- <ngxsmk-datepicker mode="range" [theme]="'light'" formControlName="bookingDates"> </ngxsmk-datepicker>
387
- </ion-item>
388
- ```
389
-
390
- ### **React, Vue, & Vanilla JS (Web Components)**
391
-
392
- 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!
393
-
394
- **1. Create a Custom Element Wrapper**
395
- ```typescript
396
- import { createApplication } from '@angular/platform-browser';
397
- import { createCustomElement } from '@angular/elements';
398
- import { NgxsmkDatepickerComponent } from 'ngxsmk-datepicker';
399
-
400
- (async () => {
401
- const app = await createApplication();
402
- const DatepickerElement = createCustomElement(NgxsmkDatepickerComponent, { injector: app.injector });
403
- customElements.define('ngxsmk-datepicker', DatepickerElement);
404
- })().catch(console.error);
405
- ```
406
-
407
- **2. Use It Natively Anywhere**
408
- ```html
409
- <!-- In any HTML, React, Vue, or Svelte file -->
410
- <ngxsmk-datepicker id="myPicker" mode="range" theme="light"></ngxsmk-datepicker>
411
-
412
- <script>
413
- // Add native DOM event listeners
414
- document.getElementById('myPicker').addEventListener('dateSelect', (e) => {
415
- console.log('Selected date:', e.detail);
416
- });
417
- </script>
418
- ```
419
-
420
- For full working examples (including React & Vue bindings), check out the `/examples` directory in our GitHub repository!
421
-
422
- ### **Plain HTML Inputs**
423
-
424
- Use with standard HTML form inputs for maximum flexibility:
425
-
426
- ```typescript
427
- import { Component } from "@angular/core";
428
- import { FormControl, FormGroup, ReactiveFormsModule } from "@angular/forms";
429
- import { NgxsmkDatepickerComponent } from "ngxsmk-datepicker";
430
-
431
- @Component({
432
- selector: "app-plain-form",
433
- standalone: true,
434
- imports: [ReactiveFormsModule, NgxsmkDatepickerComponent],
435
- template: `
436
- <form [formGroup]="myForm">
437
- <label for="birthdate">Birth Date</label>
438
- <ngxsmk-datepicker id="birthdate" mode="single" formControlName="birthdate" placeholder="MM/DD/YYYY"> </ngxsmk-datepicker>
439
-
440
- <button type="submit">Submit</button>
441
- </form>
442
- `,
443
- })
444
- export class PlainFormComponent {
445
- myForm = new FormGroup({
446
- birthdate: new FormControl<Date | null>(null),
447
- });
448
- }
449
- ```
450
-
451
- **With Native HTML5 Validation:**
452
-
453
- ```html
454
- <form [formGroup]="myForm">
455
- <div class="form-group">
456
- <label for="event-date">Event Date *</label>
457
- <ngxsmk-datepicker id="event-date" mode="single" formControlName="eventDate" [minDate]="today" required> </ngxsmk-datepicker>
458
- </div>
459
- </form>
460
- ```
461
-
462
- ### **Form Validation**
463
-
464
- 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.
465
-
466
- **Behavior:**
467
-
468
- - Native browser validation (e.g., blocking submit on `required` fields) will **NOT** trigger on the datepicker by default.
469
- - Custom validation (e.g., Angular validators) works normally but often only shows errors after the control is "touched".
470
-
471
- **Solutions:**
472
-
473
- 1. **Enable Typing (Recommended for Native Validation):**
474
- Set `[allowTyping]="true"` to make the input standard editable field. This enables native browser validation tooltips and submit-blocking.
475
-
476
- ```html
477
- <ngxsmk-datepicker [allowTyping]="true" required ...></ngxsmk-datepicker>
478
- ```
479
-
480
- 2. **Custom Validation Logic:**
481
- 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.
482
-
483
- ## **⚙️ API Reference**
484
-
485
- ### **Inputs**
486
-
487
- | Property | Type | Default | Description |
488
- | :----------------- | :--- | :------ | :---------- |
489
- | mode | 'single' \| 'range' \| 'multiple' | 'single' | The selection mode. |
490
- | inline | boolean \| 'always' \| 'auto' | false | Controls the display mode. `true` or `'always'` for inline, `'auto'` for responsive. |
491
- | locale | string | navigator.language | Sets the locale for language and regional formatting (e.g., 'en-US', 'de-DE'). |
492
- | theme | 'light' \| 'dark' | 'light' | The color theme. |
493
- | showRanges | boolean | true | If true, displays the predefined ranges panel when in 'range' mode. |
494
- | minDate | DateInput | null | The earliest selectable date. |
495
- | maxDate | DateInput | null | The latest selectable date. |
496
- | isInvalidDate | (date: Date) => boolean | () => false | A function to programmatically disable specific dates. |
497
- | ranges | DateRange | null | An object of predefined date ranges. |
498
- | minuteInterval | number | 1 | Interval for minute dropdown options. |
499
- | showTime | boolean | false | Enables the hour/minute/AM/PM selection section. |
500
- | timeOnly | boolean | false | Display time picker only (no calendar). Automatically enables `showTime`. |
501
- | use24Hour | boolean | false | Enable 24-hour time format (00-23) and hide AM/PM selector. |
502
- | allowTyping | boolean | false | Enable manual typing in the input field. Required for native validation. |
503
- | displayFormat | string | null | Custom date format string (e.g., 'MM/DD/YYYY'). |
504
- | showCalendarButton | boolean | false | Show/hide the calendar icon button. |
505
- | value | DatepickerValue | null | Programmatic value setting from code. |
506
- | startAt | DateInput | null | The date to initially center the calendar view on. |
507
- | holidayProvider | HolidayProvider | null | An object that provides holiday information. |
508
- | disableHolidays | boolean | false | If true, disables holiday dates from being selected. |
509
- | disabledDates | (string \| Date)[] | [] | Array of dates to disable. |
510
- | weekStart | number \| null | null | Override week start day (0=Sunday, 1=Monday, etc.). |
511
- | yearRange | number | 10 | Number of years before/after current year to show in year dropdown. |
512
- | clearLabel | string | 'Clear' | Custom label for the clear button. |
513
- | closeLabel | string | 'Close' | Custom label for the close button. |
514
- | prevMonthAriaLabel | string | 'Previous month' | Aria label for previous month navigation button. |
515
- | nextMonthAriaLabel | string | 'Next month' | Aria label for next month navigation button. |
516
- | clearAriaLabel | string | 'Clear selection' | Aria label for clear button. |
517
- | closeAriaLabel | string | 'Close calendar' | Aria label for close button. |
518
- | classes | object | undefined | Tailwind-friendly class overrides (wrapper, input, popover, etc.). |
519
- | enableGoogleCalendar| boolean | false | Enable seamless Google Calendar integration and sync. |
520
- | googleClientId | string \| null | null | Google API OAuth 2.0 Web Client ID for authentication. |
521
-
522
- ### **Outputs**
523
-
524
- | Event | Payload | Description |
525
- | :---------- | :------------------------------ | :------------------------------------------------------------ |
526
- | valueChange | DatepickerValue | Emits the newly selected date, range, or array of dates. |
527
- | action | { type: string; payload?: any } | Emits various events like `dateSelected`, `timeChanged`, etc. |
528
- | googleSyncClick | void | Emitted when the user clicks the Google Calendar sync button. |
529
-
530
- ## **🎨 Theming**
531
-
532
- ### CSS Variables
533
-
534
- You can easily customize the colors of the datepicker by overriding the CSS custom properties in your own stylesheet.
535
-
536
- ```css
537
- ngxsmk-datepicker {
538
- --datepicker-primary-color: #d9267d;
539
- --datepicker-primary-contrast: #ffffff;
540
- --datepicker-range-background: #fce7f3;
541
- }
542
- ```
543
-
544
- ### Tailwind/ngClass Support
545
-
546
- For Tailwind CSS or custom class-based theming, use the `classes` input:
547
-
548
- ```html
549
- <ngxsmk-datepicker
550
- mode="single"
551
- [classes]="{
552
- inputGroup: 'rounded-lg border',
553
- input: 'px-3 py-2 text-sm',
554
- popover: 'shadow-2xl',
555
- dayCell: 'hover:bg-indigo-50',
556
- footer: 'flex justify-end gap-2',
557
- clearBtn: 'btn btn-ghost',
558
- calendarBtn: 'btn btn-icon',
559
- closeBtn: 'btn btn-primary'
560
- }"
561
- >
562
- </ngxsmk-datepicker>
563
- ```
564
-
565
- ### Dark Theme
566
-
567
- To enable the dark theme, simply bind the theme input:
568
-
569
- ```html
570
- <ngxsmk-datepicker [theme]="'dark'"></ngxsmk-datepicker>
571
- ```
572
-
573
- ### Calendar Button Visibility
574
-
575
- Control the visibility of the calendar icon button:
576
-
577
- ```html
578
- <!-- Hide calendar button (default - users can still click input to open calendar) -->
579
- <ngxsmk-datepicker mode="single"> </ngxsmk-datepicker>
580
-
581
- <!-- Show calendar button -->
582
- <ngxsmk-datepicker [showCalendarButton]="true" mode="single"> </ngxsmk-datepicker>
583
-
584
- <!-- Useful with allowTyping for custom UI -->
585
- <ngxsmk-datepicker [allowTyping]="true" [showCalendarButton]="false" mode="single"> </ngxsmk-datepicker>
586
- ```
587
-
588
- ## **🌍 Localization (i18n)**
589
-
590
- 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.
591
-
592
- ### **Global Language Support**
593
-
594
- ngxsmk-datepicker v2.2.12 now features **full localization synchronization** for:
595
-
596
- - 🇺🇸 English (`en`)
597
- - 🇩🇪 German (`de`)
598
- - 🇫🇷 French (`fr`)
599
- - 🇪🇸 Spanish (`es`)
600
- - 🇸🇪 Swedish (`sv`)
601
- - 🇰🇷 Korean (`ko`)
602
- - 🇨🇳 Chinese (`zh`)
603
- - 🇯🇵 Japanese (`ja`)
604
-
605
- ### **Usage Example**
606
-
607
- ```html
608
- <!-- Force German Locale -->
609
- <ngxsmk-datepicker [locale]="'de-DE'"></ngxsmk-datepicker>
610
-
611
- <!-- Swedish with YYYY-MM-DD format and Monday week start -->
612
- <ngxsmk-datepicker [locale]="'sv-SE'"></ngxsmk-datepicker>
613
- ```
614
-
615
- The component automatically uses ISO 8601 standards (Monday start) for European locales and appropriate regional date formats.
616
-
617
- ## **🖥️ Server-Side Rendering (SSR)**
618
-
619
- The datepicker is fully compatible with Angular Universal and server-side rendering:
620
-
621
- - ✅ All browser APIs are platform-checked
622
- - No `window` or `document` access during initialization
623
- - ✅ Works with partial hydration
624
- - ✅ Compatible with zoneless applications
625
-
626
- See the [SSR Guide](./projects/ngxsmk-datepicker/docs/ssr.md) for detailed setup instructions.
627
-
628
- ## **⌨️ Keyboard Navigation**
629
-
630
- The datepicker supports full keyboard navigation for accessibility:
631
-
632
- ### Built-in Shortcuts
633
-
634
- - **Arrow Keys** (← → ↑ ↓): Navigate between dates
635
- - **Page Up/Down**: Navigate months (Shift + Page Up/Down for years)
636
- - **Home/End**: Jump to first/last day of month
637
- - **Enter/Space**: Select focused date
638
- - **Escape**: Close calendar (popover mode)
639
- - **T**: Select today's date
640
- - **Y**: Select yesterday
641
- - **N**: Select tomorrow
642
- - **W**: Select next week (7 days from today)
643
- - **Tab**: Navigate between interactive elements
644
- - **?** (Shift + /): Toggle keyboard shortcuts help dialog
645
-
646
- ### Custom Keyboard Shortcuts
647
-
648
- You can add custom keyboard shortcuts using the `hooks` input or `customShortcuts` input:
649
-
650
- ```typescript
651
- import { DatepickerHooks, KeyboardShortcutContext } from "ngxsmk-datepicker";
652
-
653
- const myHooks: DatepickerHooks = {
654
- handleShortcut: (event, context) => {
655
- if (event.ctrlKey && event.key === "1") {
656
- // Custom action
657
- return true; // Handled
658
- }
659
- return false; // Use default
660
- },
661
- };
662
- ```
663
-
664
- ```html
665
- <ngxsmk-datepicker [hooks]="myHooks" [customShortcuts]="shortcuts" mode="single"> </ngxsmk-datepicker>
666
- ```
667
-
668
- All date cells are keyboard accessible with proper ARIA attributes for screen readers.
669
-
670
- See [Extension Points Guide](./projects/ngxsmk-datepicker/docs/extension-points.md) for detailed customization options.
671
-
672
- ## **🚀 Performance Optimizations**
673
-
674
- This library has been optimized for maximum performance:
675
-
676
- - **30% Smaller Bundle**: Optimized build configuration and tree-shaking
677
- - **40% Faster Rendering**: OnPush change detection strategy with proper triggers
678
- - **60% Faster Selection**: Memoized date comparisons and debounced operations
679
- - **Zero Dependencies**: Standalone component with no external dependencies
680
- - **Tree-shakable**: Only import what you need
681
- - **Memory Efficient**: Cache size limits prevent memory leaks
682
- - **Hardware Accelerated**: CSS optimizations for smooth animations
683
- - **Mobile Optimized**: Touch-friendly interactions and responsive design
684
-
685
- ## **🐛 Bug Fixes & Improvements**
686
-
687
- ### **Critical Updates in v2.2.6:**
688
-
689
- - ✅ **Timezone Support**: Added full support for IANA timezones in "Today" calculation.
690
- - **Date Validation**: Fixed "Today" unselectable bug by normalizing `minDate` boundary checks.
691
- - **Keyboard Shortcuts**: Updated "Today" selection shortcut to use timezone-aware calculation.
692
- - **Validation messages**: User-facing i18n strings for invalid date, min/max; `validationError` output and on-screen error display
693
- - **Calendar loading state**: Visual spinner + text and screen-reader announcement while calendar opens/generates
694
- - **Demo theme**: Light/dark theme toggle and system preference now correctly switch the demo UI
695
- - **Installation options**: Full install guide (npm, Yarn, pnpm, Bun, Git, CDN, etc.) and demo page updates
696
- - **Accessibility**: Loading state announced via live region; validation errors exposed for a11y
697
- - **Type Safety**: New translation keys and strictly typed inputs/outputs
698
-
699
- ### **Performance Enhancements:**
700
-
701
- - 🚀 **Optimized Bundle Size**: Main bundle ~127KB (source maps excluded from published package)
702
- - 🚀 **40% Faster Rendering**: Enhanced OnPush change detection
703
- - 🚀 **60% Faster Selection**: Memoized date comparisons
704
- - 🚀 **Memory Efficient**: Cache size limits prevent memory leaks
705
- - 🚀 **Hardware Accelerated**: CSS optimizations for smooth animations
706
- - 🚀 **Better Tree-Shaking**: Optimized TypeScript compiler settings for smaller output
707
- - 🚀 **Production Optimized**: Source maps automatically removed from production builds
708
-
709
- ## **📱 Demo Application**
710
-
711
- A comprehensive demo application is included to showcase all features with a modern, polished UI:
712
-
713
- ```bash
714
- # Clone the repository
715
- git clone https://github.com/NGXSMK/ngxsmk-datepicker.git
716
- cd ngxsmk-datepicker
717
-
718
- # Install dependencies
719
- npm install
720
-
721
- # Run the demo app
722
- npm start
723
- ```
724
-
725
- The demo includes:
726
-
727
- - **Modern UI Design**: Beautiful glassmorphism effects, gradient themes, and polished visual hierarchy
728
- - **Responsive Navigation**: Modern navbar with search, theme toggle, and mobile-friendly menu
729
- - **Enhanced Sidebar**: Redesigned documentation sidebar with smooth animations and visual indicators
730
- - **Signal Forms (Angular 21)** with writable signal binding examples
731
- - **Theming** with CSS variables and Tailwind classes examples
732
- - **Customization & A11y** with weekStart, yearRange, labels, and aria examples
733
- - **Holiday Provider Integration** with US holidays
734
- - **Single Date Selection** with weekend restrictions
735
- - **Inline Range Picker** with toggle controls
736
- - **Date Range with Time** selection
737
- - **Multiple Date Selection** with action tracking
738
- - **Programmatic Value Setting** for all selection modes
739
- - **Theme Toggle** (Light/Dark mode) with automatic system preference detection
740
- - **Customizable Calendar Views**: Year-picker, decade-picker, timeline view, and time-slider view
741
-
742
- ## **🔧 Development**
743
-
744
- ### **GitHub Actions**
745
-
746
- The project uses GitHub Actions for automated deployment:
747
-
748
- - **Deploy Demo App**: Automatically deploys the demo application to GitHub Pages on pushes to `main`/`master` branches
749
- - Workflow: `.github/workflows/deploy-demo.yml`
750
- - Triggers: Push to main/master or manual workflow dispatch
751
- - Builds and deploys the demo app to GitHub Pages
752
-
753
- ### **Building the Library**
754
-
755
- ```bash
756
- # Build the library (development)
757
- npm run build
758
-
759
- # Build optimized production version
760
- # - Removes source maps automatically
761
- # - Optimized TypeScript compilation
762
- # - Enhanced tree-shaking
763
- npm run build:optimized
764
-
765
- # Analyze bundle size (excludes source maps)
766
- npm run build:analyze
767
- ```
768
-
769
- **Build Output:**
770
-
771
- - Main bundle: `dist/ngxsmk-datepicker/fesm2022/ngxsmk-datepicker.mjs` (~127KB)
772
- - Type definitions: `dist/ngxsmk-datepicker/index.d.ts`
773
- - Source maps: Automatically removed from production builds
774
-
775
- ### **Running Tests**
776
-
777
- ```bash
778
- # Run all tests (library + demo app)
779
- npm test
780
-
781
- # Run library tests only
782
- npx ng test ngxsmk-datepicker --no-watch --browsers=ChromeHeadless
783
-
784
- # Run specific test file
785
- npx ng test ngxsmk-datepicker --include="**/issue-13.spec.ts"
786
-
787
- # Run tests in watch mode
788
- npm test -- --watch
789
- ```
790
-
791
- ### **Code Quality Improvements**
792
-
793
- The library now includes:
794
-
795
- - **TypeScript Strict Mode**: Enhanced type safety
796
- - ✅ **ESLint Configuration**: Code quality enforcement
797
- - ✅ **Performance Monitoring**: Built-in performance metrics
798
- - **Memory Leak Prevention**: Cache size limits and cleanup
799
- - **Accessibility Testing**: WCAG compliance checks
800
- - ✅ **Mobile Testing**: Touch interaction validation
801
-
802
- ## **📦 Package Structure**
803
-
804
- ```
805
- ngxsmk-datepicker/
806
- ├── projects/
807
- │ ├── ngxsmk-datepicker/ # Main library
808
- │ └── demo-app/ # Demo application
809
- ├── dist/ # Built packages
810
- ├── docs/ # Documentation
811
- └── scripts/ # Build scripts
812
- ```
813
-
814
- ## **🎯 Browser Support**
815
-
816
- - **Chrome** 90+
817
- - **Firefox** 88+
818
- - **Safari** 14+
819
- - **Edge** 90+
820
- - **Mobile Safari** 14+
821
- - **Chrome Mobile** 90+
822
-
823
- ## **🗺️ Roadmap**
824
-
825
- 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`!
826
-
827
- ## **🤝 Contributions**
828
-
829
- 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.
830
-
831
- ### **Development Setup**
832
-
833
- 1. **Fork the repository** on GitHub
834
- 2. **Clone your fork** to your local machine
835
- 3. **Install dependencies**: `npm install`
836
- 4. **Run the demo app**: `npm start`
837
- 5. **Create a feature branch** for your changes
838
- 6. **Commit your changes** following conventional commits
839
- 7. **Submit a Pull Request** to the main branch
840
-
841
- ### **Contribution Guidelines**
842
-
843
- - Follow the existing code style
844
- - Add tests for new features
845
- - Update documentation as needed
846
- - Ensure all tests pass
847
- - Follow conventional commit messages
848
-
849
- ## **📄 Changelog**
850
-
851
- For a full list of changes, please refer to the [CHANGELOG.md](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/CHANGELOG.md) file.
852
-
853
- ### **v2.2.12** (Current Stable)
854
-
855
- - 🎉 **Version Update**: Updated to version 2.2.12.
856
- - 📦 **npm**: Published tarballs again include `fesm2022/` and TypeScript declarations (release pipeline runs `ng build` before publish).
857
- - 📅 **Range mode**: Optional `allowSameDay` for single-day ranges (double-click same date or close popover after one day).
858
- - **Prior fixes**: IANA timezone “Today”, `minDate` normalization, strict typings, and UI polish from v2.2.6 remain included.
859
-
860
- ### **Earlier Versions**
861
-
862
- For older version details, please refer to the [full CHANGELOG.md](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/CHANGELOG.md).
863
-
864
- ## **🎨 Theming with TokiForge**
865
-
866
- 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.
867
-
868
- ### Why TokiForge?
869
-
870
- - **Framework-agnostic** Works with Angular, React, Vue, Svelte, and vanilla JS
871
- - ✅ **Runtime theme switching** — Change themes dynamically without rebuilds
872
- - **Type-safe** Full TypeScript support for design tokens
873
- - ✅ **Lightweight** — <3 KB gzipped runtime footprint
874
- - **CSS custom properties** — Zero JS overhead in static mode
875
- - ✅ **SSR compatible** — Works seamlessly with Angular Universal
876
-
877
- Perfect for managing design tokens, creating theme systems, and implementing dark mode in your Angular applications!
878
-
879
- **👉 [Learn more about TokiForge →](https://tokiforge.github.io/tokiforge/)**
880
-
881
- ---
882
-
883
- ## **📜 License**
884
-
885
- MIT License - see [LICENSE](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/LICENSE) file for details.
886
-
887
- ## **🔍 SEO & Discoverability**
888
-
889
- This library is optimized for search engine visibility, especially for European markets:
890
-
891
- - **Keywords**: Angular datepicker, date range picker, calendar component, Angular 17-21, TypeScript, Signal Forms, SSR compatible
892
- - **European SEO**: Optimized for Germany, France, Spain, Italy, Netherlands, Poland, Portugal, Sweden, Norway, Finland, Denmark, Belgium, Switzerland, Austria, and United Kingdom
893
- - **Multi-language Support**: hreflang tags for 15+ European languages and locales
894
- - **European Geo-targeting**: Geo tags and structured data optimized for European Union countries
895
- - **Meta Tags**: Comprehensive Open Graph and Twitter Card support with European locale alternates
896
- - **Structured Data**: JSON-LD schema markup with European audience targeting and area served information
897
- - **Documentation**: Complete API documentation with examples
898
- - **Performance**: Optimized bundle size (~127KB) for fast loading
899
- - **European Localization**: Full i18n support for European date formats, week start days, and regional preferences
900
-
901
- ## **👨‍💻 Author**
902
-
903
- **Sachin Dilshan**
904
-
905
- - 📧 Email: [sachindilshan040@gmail.com](mailto:sachindilshan040@gmail.com)
906
- - 🐙 GitHub: [@toozuuu](https://github.com/toozuuu)
907
- - 📦 NPM: [ngxsmk-datepicker](https://www.npmjs.com/package/ngxsmk-datepicker)
908
- - 🌐 Website: [sachindilshan.com](https://www.sachindilshan.com/)
909
- - 💼 LinkedIn: [sachindilshan](https://www.linkedin.com/in/sachindilshan/)
910
-
911
- ## **⭐ Support**
912
-
913
- If you find this library helpful, please consider:
914
-
915
- - ⭐ **Starring** the repository
916
- - 🐛 **Reporting** bugs and issues
917
- - 💡 **Suggesting** new features
918
- - 🤝 **Contributing** code improvements
919
- - 📢 **Sharing** with the community
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
+ [![npm version](https://img.shields.io/npm/v/ngxsmk-datepicker.svg?style=flat-square&color=6d28d9)](https://www.npmjs.com/package/ngxsmk-datepicker)
14
+ [![Angular](https://img.shields.io/badge/Angular-17%2B-DD0031.svg?style=flat-square&logo=angular)](https://angular.io/)
15
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/NGXSMK/ngxsmk-datepicker/blob/main/LICENSE)
16
+ [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-toozuuu-orange?style=flat-square&logo=buy-me-a-coffee)](https://buymeacoffee.com/toozuuu)
17
+ [![Bundle Size](https://img.shields.io/badge/bundle-~127KB-success.svg?style=flat-square)](https://bundlephobia.com/package/ngxsmk-datepicker)
18
+ [![Zoneless](https://img.shields.io/badge/Zoneless-Ready-blueviolet.svg?style=flat-square)](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
+