ngxsmk-datepicker 3.0.5 → 3.0.6
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 +24 -10
- package/docs/API.md +48 -2
- package/docs/COMPATIBILITY.md +108 -108
- package/docs/INTEGRATION.md +10 -28
- package/docs/IONIC_INTEGRATION.md +1 -1
- package/docs/LOCALE-GUIDE.md +3 -3
- package/docs/PLUGIN-ARCHITECTURE.md +58 -58
- package/docs/SSR-EXAMPLE.md +8 -8
- package/docs/THEME-TOKENS.md +2 -2
- package/docs/TIMEZONE.md +18 -9
- package/docs/extension-points.md +5 -5
- package/docs/signal-forms.md +9 -9
- package/docs/signals.md +2 -2
- package/docs/ssr.md +11 -11
- package/fesm2022/ngxsmk-datepicker-adapters.mjs +319 -0
- package/fesm2022/ngxsmk-datepicker-material.mjs +71 -0
- package/fesm2022/ngxsmk-datepicker.mjs +2782 -2750
- package/package.json +9 -1
- package/schematics/collection.json +10 -10
- package/schematics/ng-add/schema.json +14 -14
- package/styles/ionic-integration.css +274 -274
- package/types/ngxsmk-datepicker-adapters.d.ts +155 -0
- package/types/ngxsmk-datepicker-material.d.ts +12 -0
- package/types/ngxsmk-datepicker.d.ts +174 -152
package/docs/LOCALE-GUIDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Locale Packs & i18n Contributor Guide
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
Guide for adding locale support and contributing translations to ngxsmk-datepicker.
|
|
6
6
|
|
|
@@ -185,7 +185,7 @@ Date formats vary by locale:
|
|
|
185
185
|
- **US**: `MM/DD/YYYY` (e.g., 12/25/2025)
|
|
186
186
|
- **Europe**: `DD/MM/YYYY` (e.g., 25/12/2025)
|
|
187
187
|
- **ISO**: `YYYY-MM-DD` (e.g., 2025-12-25)
|
|
188
|
-
- **Asia**: `YYYY
|
|
188
|
+
- **Asia**: `YYYY?MM?DD?` (e.g., 2025?12?25?)
|
|
189
189
|
|
|
190
190
|
The component uses `Intl.DateTimeFormat` which handles this automatically.
|
|
191
191
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Plugin Architecture
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
ngxsmk-datepicker features a powerful **plugin architecture** that allows you to extend and customize the component's behavior without modifying its core code. This architecture is built on a **hook-based system** that provides extension points throughout the component's lifecycle.
|
|
6
6
|
|
|
@@ -27,35 +27,35 @@ The plugin architecture in ngxsmk-datepicker is designed around the concept of *
|
|
|
27
27
|
### Key Concepts
|
|
28
28
|
|
|
29
29
|
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
30
|
+
+-------------------------------------------------------------+
|
|
31
|
+
� Datepicker Component �
|
|
32
|
+
� �
|
|
33
|
+
� +------------------------------------------------------+ �
|
|
34
|
+
� � Core Component Logic � �
|
|
35
|
+
� � � �
|
|
36
|
+
� � +----------+ +----------+ +----------+ � �
|
|
37
|
+
� � � Render � � Validate � � Events � � �
|
|
38
|
+
� � � Hooks � � Hooks � � Hooks � � �
|
|
39
|
+
� � +----------+ +----------+ +----------+ � �
|
|
40
|
+
� � � � � � �
|
|
41
|
+
� � +-------------+-------------+ � �
|
|
42
|
+
� � � � �
|
|
43
|
+
� � +------?------+ � �
|
|
44
|
+
� � � Plugin � � �
|
|
45
|
+
� � � Registry � � �
|
|
46
|
+
� � +-------------+ � �
|
|
47
|
+
� � � � �
|
|
48
|
+
� +---------------------+-------------------------------+ �
|
|
49
|
+
� � �
|
|
50
|
+
+------------------------+-----------------------------------+
|
|
51
|
+
�
|
|
52
|
+
�
|
|
53
|
+
+---------------+---------------+
|
|
54
|
+
� � �
|
|
55
|
+
+----?----+ +----?----+ +----?----+
|
|
56
|
+
� Plugin � � Plugin � � Plugin �
|
|
57
|
+
� A � � B � � C �
|
|
58
|
+
+---------+ +---------+ +---------+
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
## Architecture Principles
|
|
@@ -65,12 +65,12 @@ The plugin architecture in ngxsmk-datepicker is designed around the concept of *
|
|
|
65
65
|
Plugins extend functionality without modifying core code:
|
|
66
66
|
|
|
67
67
|
```typescript
|
|
68
|
-
//
|
|
68
|
+
// ? Good: Plugin extends behavior
|
|
69
69
|
const myPlugin: DatepickerHooks = {
|
|
70
70
|
validateDate: (date) => date.getDay() !== 0 // Disable Sundays
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
//
|
|
73
|
+
// ? Bad: Modifying core component (not possible, but conceptually wrong)
|
|
74
74
|
// Don't try to override internal methods
|
|
75
75
|
```
|
|
76
76
|
|
|
@@ -170,7 +170,7 @@ const stylingPlugin: DatepickerHooks = {
|
|
|
170
170
|
|
|
171
171
|
getDayCellTooltip: (date, holidayLabel) => {
|
|
172
172
|
if (holidayLabel) {
|
|
173
|
-
return
|
|
173
|
+
return `?? ${holidayLabel}`;
|
|
174
174
|
}
|
|
175
175
|
return `Date: ${date.toLocaleDateString()}`;
|
|
176
176
|
}
|
|
@@ -309,7 +309,7 @@ const formattingPlugin: DatepickerHooks = {
|
|
|
309
309
|
|
|
310
310
|
if (mode === 'range' && typeof value === 'object' && 'start' in value) {
|
|
311
311
|
const range = value as { start: Date; end: Date };
|
|
312
|
-
return `${range.start.toLocaleDateString()}
|
|
312
|
+
return `${range.start.toLocaleDateString()} ? ${range.end.toLocaleDateString()}`;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
return ''; // Use default
|
|
@@ -529,20 +529,20 @@ Understanding when hooks are called helps you write effective plugins:
|
|
|
529
529
|
### 1. **Initialization Phase**
|
|
530
530
|
|
|
531
531
|
```
|
|
532
|
-
Component Init
|
|
532
|
+
Component Init ? Calendar Generation ? Hook: getDayCellClasses (for each date)
|
|
533
533
|
```
|
|
534
534
|
|
|
535
535
|
### 2. **User Interaction Phase**
|
|
536
536
|
|
|
537
537
|
```
|
|
538
538
|
User Clicks Date
|
|
539
|
-
|
|
539
|
+
?
|
|
540
540
|
Hook: beforeDateSelect (can prevent selection)
|
|
541
|
-
|
|
541
|
+
?
|
|
542
542
|
Hook: validateDate (can prevent selection)
|
|
543
|
-
|
|
543
|
+
?
|
|
544
544
|
Date Selected (if allowed)
|
|
545
|
-
|
|
545
|
+
?
|
|
546
546
|
Hook: afterDateSelect
|
|
547
547
|
```
|
|
548
548
|
|
|
@@ -550,7 +550,7 @@ Hook: afterDateSelect
|
|
|
550
550
|
|
|
551
551
|
```
|
|
552
552
|
Calendar Render
|
|
553
|
-
|
|
553
|
+
?
|
|
554
554
|
For each date:
|
|
555
555
|
- Hook: getDayCellClasses
|
|
556
556
|
- Hook: getDayCellTooltip
|
|
@@ -561,9 +561,9 @@ For each date:
|
|
|
561
561
|
|
|
562
562
|
```
|
|
563
563
|
Key Press
|
|
564
|
-
|
|
564
|
+
?
|
|
565
565
|
Hook: handleShortcut (can handle custom shortcuts)
|
|
566
|
-
|
|
566
|
+
?
|
|
567
567
|
Default Shortcut Handling (if not handled)
|
|
568
568
|
```
|
|
569
569
|
|
|
@@ -571,9 +571,9 @@ Default Shortcut Handling (if not handled)
|
|
|
571
571
|
|
|
572
572
|
```
|
|
573
573
|
Value Change
|
|
574
|
-
|
|
574
|
+
?
|
|
575
575
|
Hook: formatDisplayValue (for input display)
|
|
576
|
-
|
|
576
|
+
?
|
|
577
577
|
Display Updated
|
|
578
578
|
```
|
|
579
579
|
|
|
@@ -698,12 +698,12 @@ const validationPlugin = createValidationMiddleware(
|
|
|
698
698
|
Each plugin should have a single responsibility:
|
|
699
699
|
|
|
700
700
|
```typescript
|
|
701
|
-
//
|
|
701
|
+
// ? Good: Focused plugin
|
|
702
702
|
const weekendBlocker: DatepickerHooks = {
|
|
703
703
|
validateDate: (date) => date.getDay() !== 0 && date.getDay() !== 6
|
|
704
704
|
};
|
|
705
705
|
|
|
706
|
-
//
|
|
706
|
+
// ? Bad: Too many responsibilities
|
|
707
707
|
const megaPlugin: DatepickerHooks = {
|
|
708
708
|
validateDate: (date) => { /* ... */ },
|
|
709
709
|
getDayCellClasses: (date) => { /* ... */ },
|
|
@@ -718,14 +718,14 @@ const megaPlugin: DatepickerHooks = {
|
|
|
718
718
|
Design plugins to be reusable across projects:
|
|
719
719
|
|
|
720
720
|
```typescript
|
|
721
|
-
//
|
|
721
|
+
// ? Good: Configurable and reusable
|
|
722
722
|
export function createBusinessDaysPlugin(config: BusinessDaysConfig): DatepickerHooks {
|
|
723
723
|
return {
|
|
724
724
|
validateDate: (date) => config.allowedDays.includes(date.getDay())
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
727
|
|
|
728
|
-
//
|
|
728
|
+
// ? Bad: Hard-coded and not reusable
|
|
729
729
|
const myBusinessDays: DatepickerHooks = {
|
|
730
730
|
validateDate: (date) => [1, 2, 3, 4, 5].includes(date.getDay())
|
|
731
731
|
};
|
|
@@ -736,7 +736,7 @@ const myBusinessDays: DatepickerHooks = {
|
|
|
736
736
|
Keep hook functions lightweight:
|
|
737
737
|
|
|
738
738
|
```typescript
|
|
739
|
-
//
|
|
739
|
+
// ? Good: Lightweight and memoized
|
|
740
740
|
const memoizedValidation = new Map<string, boolean>();
|
|
741
741
|
|
|
742
742
|
const optimizedPlugin: DatepickerHooks = {
|
|
@@ -751,7 +751,7 @@ const optimizedPlugin: DatepickerHooks = {
|
|
|
751
751
|
}
|
|
752
752
|
};
|
|
753
753
|
|
|
754
|
-
//
|
|
754
|
+
// ? Bad: Expensive operation on every call
|
|
755
755
|
const slowPlugin: DatepickerHooks = {
|
|
756
756
|
validateDate: (date) => {
|
|
757
757
|
// Expensive API call on every validation
|
|
@@ -765,7 +765,7 @@ const slowPlugin: DatepickerHooks = {
|
|
|
765
765
|
Use `getValidationError` for user-friendly messages:
|
|
766
766
|
|
|
767
767
|
```typescript
|
|
768
|
-
//
|
|
768
|
+
// ? Good: Clear error messages
|
|
769
769
|
const userFriendlyPlugin: DatepickerHooks = {
|
|
770
770
|
validateDate: (date) => {
|
|
771
771
|
const today = new Date();
|
|
@@ -917,12 +917,12 @@ export class BookingComponent {
|
|
|
917
917
|
|
|
918
918
|
The plugin architecture in ngxsmk-datepicker provides:
|
|
919
919
|
|
|
920
|
-
-
|
|
921
|
-
-
|
|
922
|
-
-
|
|
923
|
-
-
|
|
924
|
-
-
|
|
925
|
-
-
|
|
920
|
+
- ? **Non-invasive extension** - Extend without modifying core code
|
|
921
|
+
- ? **Type safety** - Full TypeScript support
|
|
922
|
+
- ? **Composability** - Combine multiple plugins
|
|
923
|
+
- ? **Flexibility** - Optional and configurable
|
|
924
|
+
- ? **Performance** - Lightweight hook system
|
|
925
|
+
- ? **Maintainability** - Clear separation of concerns
|
|
926
926
|
|
|
927
927
|
For more examples and detailed hook documentation, see [Extension Points Guide](./extension-points.md).
|
|
928
928
|
|
package/docs/SSR-EXAMPLE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Server-Side Rendering (SSR) Example
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
Complete example demonstrating ngxsmk-datepicker with Angular Universal (SSR).
|
|
6
6
|
|
|
@@ -90,15 +90,15 @@ export class DatepickerDemoComponent {
|
|
|
90
90
|
Always provide an explicit locale for SSR consistency:
|
|
91
91
|
|
|
92
92
|
```typescript
|
|
93
|
-
//
|
|
93
|
+
// ? Bad - relies on browser API
|
|
94
94
|
locale = navigator.language;
|
|
95
95
|
|
|
96
|
-
//
|
|
96
|
+
// ? Good - platform-checked
|
|
97
97
|
locale = isPlatformBrowser(this.platformId)
|
|
98
98
|
? navigator.language || 'en-US'
|
|
99
99
|
: 'en-US';
|
|
100
100
|
|
|
101
|
-
//
|
|
101
|
+
// ? Better - use service or config
|
|
102
102
|
locale = this.localeService.getLocale(); // Returns 'en-US' on server
|
|
103
103
|
```
|
|
104
104
|
|
|
@@ -107,7 +107,7 @@ locale = this.localeService.getLocale(); // Returns 'en-US' on server
|
|
|
107
107
|
Dates work the same on server and client:
|
|
108
108
|
|
|
109
109
|
```typescript
|
|
110
|
-
//
|
|
110
|
+
// ? Safe - Date works on both server and client
|
|
111
111
|
const today = new Date();
|
|
112
112
|
const minDate = new Date(2025, 0, 1); // January 1, 2025
|
|
113
113
|
```
|
|
@@ -331,7 +331,7 @@ export class MyComponent implements AfterViewInit {
|
|
|
331
331
|
**Solution**: Always provide explicit locale:
|
|
332
332
|
|
|
333
333
|
```typescript
|
|
334
|
-
//
|
|
334
|
+
// ? Correct
|
|
335
335
|
<ngxsmk-datepicker [locale]="'en-US'"></ngxsmk-datepicker>
|
|
336
336
|
|
|
337
337
|
// Or use platform check
|
|
@@ -347,7 +347,7 @@ locale = isPlatformBrowser(this.platformId)
|
|
|
347
347
|
**Solution**: Use consistent locale and timezone:
|
|
348
348
|
|
|
349
349
|
```typescript
|
|
350
|
-
//
|
|
350
|
+
// ? Correct
|
|
351
351
|
provideDatepickerConfig({
|
|
352
352
|
locale: 'en-US',
|
|
353
353
|
timezone: 'UTC' // Use UTC for consistency
|
package/docs/THEME-TOKENS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Theme Tokens & CSS Custom Properties
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
Complete reference for all CSS custom properties (CSS variables) available in ngxsmk-datepicker.
|
|
6
6
|
|
package/docs/TIMEZONE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Timezone Support
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -147,7 +147,16 @@ const serverDate = new Date("2024-01-15T15:00:00Z");
|
|
|
147
147
|
|
|
148
148
|
## Optional Adapters (date-fns / Luxon)
|
|
149
149
|
|
|
150
|
-
For advanced timezone operations, you may want to use specialized libraries:
|
|
150
|
+
For advanced timezone operations, you may want to use specialized libraries. Built-in date adapters for the datepicker config live on the secondary entry:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { DateFnsAdapter, LuxonAdapter, DayjsAdapter } from 'ngxsmk-datepicker/adapters';
|
|
154
|
+
import { provideDatepickerConfig } from 'ngxsmk-datepicker';
|
|
155
|
+
|
|
156
|
+
provideDatepickerConfig({
|
|
157
|
+
dateAdapter: new LuxonAdapter(), // or DateFnsAdapter / DayjsAdapter
|
|
158
|
+
});
|
|
159
|
+
```
|
|
151
160
|
|
|
152
161
|
### date-fns-tz
|
|
153
162
|
|
|
@@ -218,10 +227,10 @@ export class MyComponent {
|
|
|
218
227
|
**Solution**: Ensure you're setting the `timezone` property correctly:
|
|
219
228
|
|
|
220
229
|
```typescript
|
|
221
|
-
//
|
|
230
|
+
// ? Correct
|
|
222
231
|
<ngxsmk-datepicker [timezone]="'America/New_York'">
|
|
223
232
|
|
|
224
|
-
//
|
|
233
|
+
// ? Incorrect (missing quotes)
|
|
225
234
|
<ngxsmk-datepicker [timezone]="America/New_York">
|
|
226
235
|
```
|
|
227
236
|
|
|
@@ -230,10 +239,10 @@ export class MyComponent {
|
|
|
230
239
|
**Solution**: JavaScript Date objects are already UTC. Send them directly:
|
|
231
240
|
|
|
232
241
|
```typescript
|
|
233
|
-
//
|
|
242
|
+
// ? Correct
|
|
234
243
|
const utcString = date.toISOString(); // Send this to server
|
|
235
244
|
|
|
236
|
-
//
|
|
245
|
+
// ? Incorrect (don't manually adjust)
|
|
237
246
|
const adjusted = new Date(date.getTime() - timezoneOffset); // Don't do this
|
|
238
247
|
```
|
|
239
248
|
|
|
@@ -242,10 +251,10 @@ const adjusted = new Date(date.getTime() - timezoneOffset); // Don't do this
|
|
|
242
251
|
**Solution**: Create Date objects from ISO strings:
|
|
243
252
|
|
|
244
253
|
```typescript
|
|
245
|
-
//
|
|
254
|
+
// ? Correct
|
|
246
255
|
const date = new Date(serverResponse.dateString); // "2024-01-15T15:00:00Z"
|
|
247
256
|
|
|
248
|
-
//
|
|
257
|
+
// ? Incorrect (may parse in wrong timezone)
|
|
249
258
|
const date = new Date(serverResponse.dateString.replace('Z', '')); // Don't remove Z
|
|
250
259
|
```
|
|
251
260
|
|
package/docs/extension-points.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
# Extension Points and Hooks
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
ngxsmk-datepicker provides comprehensive extension points through the `hooks` input, allowing you to customize rendering, validation, keyboard shortcuts, formatting, and event handling.
|
|
6
6
|
|
|
7
|
-
>
|
|
7
|
+
> **?? For a complete understanding of the plugin architecture, see the [Plugin Architecture Guide](./PLUGIN-ARCHITECTURE.md)** which covers architecture principles, plugin patterns, lifecycle, and advanced use cases.
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
@@ -248,7 +248,7 @@ myHooks: DatepickerHooks = {
|
|
|
248
248
|
|
|
249
249
|
if (mode === 'range' && typeof value === 'object' && 'start' in value) {
|
|
250
250
|
const range = value as { start: Date; end: Date };
|
|
251
|
-
return `${range.start.toLocaleDateString()}
|
|
251
|
+
return `${range.start.toLocaleDateString()} ? ${range.end.toLocaleDateString()}`;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
return ''; // Use default
|
|
@@ -373,7 +373,7 @@ The datepicker includes these built-in shortcuts:
|
|
|
373
373
|
|
|
374
374
|
| Key | Action |
|
|
375
375
|
|-----|--------|
|
|
376
|
-
|
|
|
376
|
+
| `?` `?` `?` `?` | Navigate dates |
|
|
377
377
|
| `Page Up` | Previous month |
|
|
378
378
|
| `Page Down` | Next month |
|
|
379
379
|
| `Shift + Page Up` | Previous year |
|
package/docs/signal-forms.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Signal Forms Integration
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
This guide covers using ngxsmk-datepicker with Angular 21+ Signal Forms API.
|
|
6
6
|
|
|
@@ -193,8 +193,8 @@ export class FormComponent {
|
|
|
193
193
|
1. **Use `[field]` binding for automatic dirty tracking**: The datepicker uses the field's `setValue()` or `updateValue()` methods when available, which properly track dirty state in Angular Signal Forms.
|
|
194
194
|
|
|
195
195
|
2. **Avoid mixing `[field]` with manual `(valueChange)` handlers**: If you use both `[field]` and `(valueChange)="dateField.set($event)"`, the manual handler bypasses the form API and may prevent dirty state tracking. Use one or the other:
|
|
196
|
-
-
|
|
197
|
-
-
|
|
196
|
+
- ? **Recommended**: Use only `[field]="myForm.dateField"` for automatic dirty tracking
|
|
197
|
+
- ?? **Alternative**: Use `[value]` and `(valueChange)` with proper form API methods if you need manual control
|
|
198
198
|
|
|
199
199
|
3. **Manual binding pattern**: If you must use manual binding (e.g., for stability issues), ensure you update the form using the field's API methods:
|
|
200
200
|
```typescript
|
|
@@ -295,7 +295,7 @@ export class StableFormComponent {
|
|
|
295
295
|
|
|
296
296
|
**Note:** The `$any($event)` cast may be needed if there's a type mismatch between `DatepickerValue` and your expected `Date` type.
|
|
297
297
|
|
|
298
|
-
|
|
298
|
+
**?? Warning**: Direct mutation (`this.myForm.value().myDate = newDate`) bypasses Angular's dirty tracking mechanism. Always prefer using `setValue()` or `updateValue()` when available.
|
|
299
299
|
|
|
300
300
|
## Validation
|
|
301
301
|
|
|
@@ -569,13 +569,13 @@ If `form().dirty()` returns `false` after selecting a date:
|
|
|
569
569
|
|
|
570
570
|
1. **Ensure you're using `[field]` binding**: The `[field]` input automatically uses the form's API methods to track dirty state.
|
|
571
571
|
```html
|
|
572
|
-
<!--
|
|
572
|
+
<!-- ? Correct - uses [field] binding -->
|
|
573
573
|
<ngxsmk-datepicker [field]="myForm.dateField" mode="single"></ngxsmk-datepicker>
|
|
574
574
|
```
|
|
575
575
|
|
|
576
576
|
2. **Avoid mixing `[field]` with manual `(valueChange)`**: Don't use both together, as the manual handler may bypass form tracking:
|
|
577
577
|
```html
|
|
578
|
-
<!--
|
|
578
|
+
<!-- ? Incorrect - manual handler bypasses form API -->
|
|
579
579
|
<ngxsmk-datepicker
|
|
580
580
|
[field]="myForm.dateField"
|
|
581
581
|
(valueChange)="dateField.set($event)"
|
|
@@ -586,10 +586,10 @@ If `form().dirty()` returns `false` after selecting a date:
|
|
|
586
586
|
3. **Use form API methods in manual handlers**: If you must use manual binding, use `setValue()` or `updateValue()`:
|
|
587
587
|
```typescript
|
|
588
588
|
onDateChange(newDate: Date): void {
|
|
589
|
-
//
|
|
589
|
+
// ? Correct - uses form API
|
|
590
590
|
this.myForm.dateField.setValue(newDate);
|
|
591
591
|
|
|
592
|
-
//
|
|
592
|
+
// ? Incorrect - bypasses dirty tracking
|
|
593
593
|
// this.dateField.set(newDate);
|
|
594
594
|
}
|
|
595
595
|
```
|
package/docs/signals.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Signals Integration Guide
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
ngxsmk-datepicker is fully compatible with Angular Signals, providing seamless integration with both traditional reactive forms and modern signal-based patterns.
|
|
6
6
|
|
package/docs/ssr.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Server-Side Rendering (SSR) Guide
|
|
2
2
|
|
|
3
|
-
**Last updated:**
|
|
3
|
+
**Last updated:** September 8, 2026 - **Current stable:** v3.0.6
|
|
4
4
|
|
|
5
5
|
ngxsmk-datepicker is fully compatible with Angular Universal and server-side rendering. This guide covers SSR setup, best practices, and troubleshooting.
|
|
6
6
|
|
|
@@ -8,11 +8,11 @@ ngxsmk-datepicker is fully compatible with Angular Universal and server-side ren
|
|
|
8
8
|
|
|
9
9
|
The datepicker is designed to work seamlessly in both server and browser environments:
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
11
|
+
- ? All browser-only APIs are guarded with platform checks
|
|
12
|
+
- ? No direct `window` or `document` access during initialization
|
|
13
|
+
- ? Event listeners only attach in browser environment
|
|
14
|
+
- ? Compatible with Angular Universal
|
|
15
|
+
- ? Supports partial hydration
|
|
16
16
|
|
|
17
17
|
## Basic SSR Setup
|
|
18
18
|
|
|
@@ -167,10 +167,10 @@ npm run serve:ssr
|
|
|
167
167
|
**Solution**: Ensure date values are properly serialized/deserialized. Use `Date` objects, not strings, when possible:
|
|
168
168
|
|
|
169
169
|
```typescript
|
|
170
|
-
//
|
|
170
|
+
// ? Bad - may cause issues
|
|
171
171
|
date: "2024-01-15"
|
|
172
172
|
|
|
173
|
-
//
|
|
173
|
+
// ? Good
|
|
174
174
|
date: new Date("2024-01-15")
|
|
175
175
|
```
|
|
176
176
|
|
|
@@ -231,8 +231,8 @@ Browser-only features are lazily initialized:
|
|
|
231
231
|
|
|
232
232
|
The datepicker works with or without Zone.js:
|
|
233
233
|
|
|
234
|
-
-
|
|
235
|
-
-
|
|
234
|
+
- ? Works with Zone.js (default)
|
|
235
|
+
- ? Works without Zone.js (zoneless)
|
|
236
236
|
- Uses `ChangeDetectorRef.markForCheck()` for manual change detection
|
|
237
237
|
- Compatible with Angular's zoneless mode
|
|
238
238
|
|