ngxsmk-datepicker
Version:
<!-- 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 Meta Description: The
444 lines (340 loc) โข 15.8 kB
Markdown
# Version Compatibility Matrix
**Last updated:** March 21, 2026 ยท **Current stable:** v2.2.8
This document provides comprehensive compatibility information for `ngxsmk-datepicker` across different Angular versions, Zone.js configurations, and SSR/CSR setups.
## ๐ Angular Version Compatibility
### Compatibility Matrix
| Angular Version | Status | Core Features | Signal Features | Signal Forms | SSR Support | Notes |
|----------------|--------|--------------|----------------|--------------|-------------|-------|
| **Angular 17** | โ
Fully Supported | โ
All | โ
Signals, Computed | โ Not Available | โ
Full | Minimum supported version |
| **Angular 18** | โ
Fully Supported | โ
All | โ
Signals, Computed, Effects | โ Not Available | โ
Full | Enhanced signal support |
| **Angular 19** | โ
Fully Supported | โ
All | โ
Signals, Computed, Effects | โ Not Available | โ
Full | Optimized performance |
| **Angular 20** | โ
Fully Supported | โ
All | โ
Signals, Computed, Effects | โ Not Available | โ
Full | Fully supported |
| **Angular 21** | โ
Fully Supported | โ
All | โ
Signals, Computed, Effects | โ
Signal Forms `[field]` | โ
Full | **Officially released - Current development target**<br/>โ
Signal Forms (experimental)<br/>โ
Zoneless by default<br/>โ
Vitest compatible<br/>โ
Angular Aria compatible |
| **Angular 22+** | ๐ Future Support | โ
All | โ
Signals, Computed, Effects | โ
Signal Forms `[field]` | โ
Full | Peer dependency: `<24.0.0` |
### Feature Availability by Angular Version
#### Core Features (Available in all versions)
- โ
Date selection (single, range, multiple)
- โ
Time selection
- โ
Calendar views (month, year, decade, timeline, time-slider)
- โ
Keyboard navigation
- โ
Touch gestures
- โ
RTL support
- โ
Timezone support
- โ
Custom formatting
- โ
Holiday provider integration
- โ
Custom hooks and extensions
- โ
Accessibility (ARIA, keyboard)
- โ
Theming (light/dark)
- โ
Translations/i18n
#### Signal Features (Angular 17+)
- โ
`signal()` - Reactive state management
- โ
`computed()` - Derived reactive values
- โ
`effect()` - Side effects (Angular 18+)
- โ
`inject()` - Dependency injection
#### Signal Forms (Angular 21+)
- โ
`[field]` input binding (experimental Angular 21 feature)
- โ
Automatic field synchronization
- โ
Reactive form field updates
- โ
Signal-based value management
- โ
Works with `form()`, `objectSchema()`, and `validators`
- โ
Compatible with `httpResource` and `linkedSignal` patterns
#### Angular 21 New Features Compatibility
- โ
**Zoneless by Default**: Fully compatible with Angular 21 apps that don't include Zone.js
- โ
**Vitest Test Runner**: Library works in apps using Vitest (Angular 21 default)
- โ
**Angular Aria**: Compatible with Angular Aria components; uses custom ARIA implementation for screen reader support
### Peer Dependencies
```json
{
"@angular/common": ">=17.0.0 <24.0.0",
"@angular/core": ">=17.0.0 <24.0.0",
"@angular/forms": ">=17.0.0 <24.0.0"
}
```
**Zone.js**: Optional (declared in `peerDependenciesMeta`)
## ๐ Zone.js vs Zoneless Compatibility
### Overview
`ngxsmk-datepicker` is designed to work **with or without Zone.js**, making it compatible with both traditional Angular applications and modern zoneless applications.
### Zone.js Required Features
| Feature | With Zone.js | Without Zone.js | Notes |
|---------|--------------|-----------------|-------|
| **Change Detection** | โ
Automatic | โ
Manual (OnPush) | Component uses `OnPush` strategy |
| **Form Integration** | โ
Works | โ
Works | Uses `ControlValueAccessor` |
| **Event Handling** | โ
Works | โ
Works | Native event listeners |
| **Signal Updates** | โ
Works | โ
Works | Signals trigger change detection |
| **Reactive Forms** | โ
Works | โ
Works | FormControl integration |
| **Signal Forms** | โ
Works | โ
Works | Angular 21+ signal forms |
### Zoneless Setup
The component uses **OnPush change detection strategy** and **signals** for reactive updates, making it fully compatible with zoneless applications:
```typescript
@Component({
selector: 'ngxsmk-datepicker',
changeDetection: ChangeDetectionStrategy.OnPush, // โ
Zoneless compatible
// ...
})
```
#### Manual Change Detection
When using without Zone.js, the component handles change detection internally:
```typescript
// Component automatically calls markForCheck() when needed
private scheduleChangeDetection(): void {
if (!this._changeDetectionScheduled) {
this._changeDetectionScheduled = true;
Promise.resolve().then(() => {
this._changeDetectionScheduled = false;
this.cdr.markForCheck();
});
}
}
```
#### Signal-Based Reactivity
The component uses Angular signals for reactive state:
```typescript
// Reactive calendar open state
private _isCalendarOpen = signal<boolean>(false);
// Computed dependencies for memoization
private _memoDependencies = computed(() => ({
month: this._currentMonthSignal(),
year: this._currentYearSignal(),
// ...
}));
```
### Zone.js Configuration
#### With Zone.js (Default)
```typescript
// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent);
// Zone.js is automatically included
```
#### Without Zone.js (Zoneless)
```typescript
// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, {
providers: [
// No Zone.js provider needed
// Component works with OnPush + signals
]
});
```
### Migration Guide: Zone.js โ Zoneless
1. **Remove Zone.js dependency** (if desired)
2. **Ensure OnPush strategy** (already used by component)
3. **Use signals for state** (component already uses signals)
4. **No code changes needed** - component is zoneless-ready
## ๐ SSR vs CSR Compatibility
### Server-Side Rendering (SSR)
The component is **fully compatible** with Angular Universal and SSR.
#### SSR-Safe Features
| Feature | SSR Support | Implementation |
|---------|-------------|----------------|
| **Platform Detection** | โ
Safe | Uses `isPlatformBrowser()` and `PLATFORM_ID` |
| **DOM Access** | โ
Safe | Guarded with `isBrowser` checks |
| **Event Listeners** | โ
Safe | Only attached in browser |
| **Date Formatting** | โ
Safe | Uses `Intl` API (available in Node.js) |
| **Local Storage** | โ
Safe | Not used |
| **Window/Document** | โ
Safe | Guarded with platform checks |
#### SSR Implementation Details
```typescript
// Platform detection
private readonly platformId = inject(PLATFORM_ID);
private readonly isBrowser = isPlatformBrowser(this.platformId);
// Safe DOM access
if (this.isBrowser && typeof document !== 'undefined') {
// Browser-only code
document.documentElement.dir === 'rtl';
}
// Safe event listeners
if (this.isBrowser) {
// Attach event listeners
}
```
#### SSR-Specific Considerations
1. **Initial Render**: Component renders safely on server
2. **Hydration**: Client-side hydration works correctly
3. **Date Formatting**: Uses `Intl.DateTimeFormat` (available in Node.js 13+)
4. **Locale Detection**: Falls back to 'en-US' on server if `navigator` is unavailable
### Client-Side Rendering (CSR)
All features work identically in CSR mode. No special configuration needed.
### SSR vs CSR Differences
| Aspect | SSR | CSR | Notes |
|--------|-----|-----|-------|
| **Initial Render** | Server | Browser | Component renders on both |
| **DOM Access** | โ Not Available | โ
Available | Guarded with `isPlatformBrowser()` |
| **Event Listeners** | โ Not Attached | โ
Attached | Only in browser |
| **Date Formatting** | โ
Works | โ
Works | Uses `Intl` API |
| **Locale Detection** | โ ๏ธ Limited | โ
Full | Server uses default, browser detects |
| **Performance** | โ
Fast Initial Load | โ
Interactive | SSR improves SEO and initial load |
### SSR Setup Example
```typescript
// app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideClientHydration } from '@angular/platform-browser';
export const appConfig: ApplicationConfig = {
providers: [
provideClientHydration(), // Enable SSR hydration
// ... other providers
]
};
```
```typescript
// Component usage (works in both SSR and CSR)
@Component({
template: `
<ngxsmk-datepicker
[locale]="'en-US'"
mode="single">
</ngxsmk-datepicker>
`
})
export class MyComponent {
// Component automatically handles SSR/CSR differences
}
```
## ๐ง Feature Compatibility Matrix
### By Angular Version
| Feature | Angular 17 | Angular 18 | Angular 19 | Angular 20 | Angular 21+ |
|---------|------------|-----------|------------|------------|-------------|
| **Standalone Component** | โ
| โ
| โ
| โ
| โ
|
| **Signals** | โ
| โ
| โ
| โ
| โ
|
| **Computed Signals** | โ
| โ
| โ
| โ
| โ
|
| **Effects** | โ ๏ธ Limited | โ
| โ
| โ
| โ
|
| **Signal Forms** | โ | โ | โ | โ | โ
|
| **ControlValueAccessor** | โ
| โ
| โ
| โ
| โ
|
| **Reactive Forms** | โ
| โ
| โ
| โ
| โ
|
| **OnPush Strategy** | โ
| โ
| โ
| โ
| โ
|
| **SSR Support** | โ
| โ
| โ
| โ
| โ
|
| **Zoneless Support** | โ
| โ
| โ
| โ
| โ
|
| **Translations/i18n** | โ
| โ
| โ
| โ
| โ
|
| **Locale Registry** | โ
| โ
| โ
| โ
| โ
|
### By Configuration
| Configuration | Zone.js | Zoneless | SSR | CSR |
|---------------|---------|----------|-----|-----|
| **Change Detection** | โ
Auto | โ
Manual | โ
Works | โ
Works |
| **Form Integration** | โ
Works | โ
Works | โ
Works | โ
Works |
| **Event Handling** | โ
Works | โ
Works | โ ๏ธ Browser Only | โ
Works |
| **Signal Updates** | โ
Works | โ
Works | โ
Works | โ
Works |
| **Date Formatting** | โ
Works | โ
Works | โ
Works | โ
Works |
| **Keyboard Navigation** | โ
Works | โ
Works | โ ๏ธ Browser Only | โ
Works |
| **Touch Gestures** | โ
Works | โ
Works | โ ๏ธ Browser Only | โ
Works |
## ๐ Migration Guides
### Upgrading from Angular 17 to 21
1. **Update Angular dependencies**:
```bash
ng update @angular/core @angular/cli
```
2. **Enable Signal Forms** (Angular 21+):
```typescript
// Before (Angular 17-20)
<ngxsmk-datepicker
[value]="dateValue"
(valueChange)="dateValue = $event">
</ngxsmk-datepicker>
// After (Angular 21+)
<ngxsmk-datepicker
[field]="myForm.myDate">
</ngxsmk-datepicker>
```
3. **No breaking changes** - all existing code continues to work
### Migrating to Zoneless
1. **Remove Zone.js** (optional):
```bash
npm uninstall zone.js
```
2. **Update bootstrap** (if needed):
```typescript
// No changes needed - component is already zoneless-ready
```
3. **Verify OnPush strategy** (already used):
```typescript
// Component already uses OnPush
changeDetection: ChangeDetectionStrategy.OnPush
```
### Enabling SSR
1. **Install Angular Universal**:
```bash
ng add @angular/ssr
```
2. **Configure SSR**:
```typescript
// app.config.ts
import { provideClientHydration } from '@angular/platform-browser';
export const appConfig: ApplicationConfig = {
providers: [provideClientHydration()]
};
```
3. **No component changes needed** - component is SSR-safe
## โ ๏ธ Known Limitations
### Angular 17
- Effects support is limited (use signals/computed instead)
- Signal Forms not available (use `[value]` binding)
### SSR
- DOM-dependent features only work in browser (keyboard navigation, touch gestures)
- Locale auto-detection falls back to 'en-US' on server
### Zoneless
- Requires manual change detection (handled automatically by component)
- Form integration works the same as with Zone.js
## ๐งช Testing Compatibility
The component is tested against:
- โ
Angular 17, 18, 19, 20, 21
- โ
With and without Zone.js
- โ
SSR and CSR modes
- โ
Various browser environments
- โ
**Vitest Compatible**: Works in Angular 21 applications using Vitest (Angular 21 default test runner)
- Library tests use Karma/Jasmine, but the library itself is fully compatible with Vitest-based apps
- No changes needed when using Vitest in your Angular 21 application
## ๐ Angular 21 New Features Support
### Signal Forms (Experimental)
- โ
**Full Support**: `[field]` input binding for direct Signal Forms integration
- โ
**Automatic Sync**: Two-way binding with signal form fields
- โ
**Validation**: Respects field validation and disabled state
- โ
**Server Integration**: Works with `httpResource` and `linkedSignal` patterns
### Zoneless by Default
- โ
**Fully Compatible**: Works in Angular 21 apps without Zone.js
- โ
**OnPush Strategy**: Uses OnPush change detection for optimal performance
- โ
**Signal-Based**: Leverages signals for reactive updates
- โ
**No Changes Needed**: Existing code works without modification
### Vitest Test Runner
- โ
**Compatible**: Library works in apps using Vitest (Angular 21 default)
- โ
**No Migration Required**: Use the library as-is in Vitest-based projects
- โ
**Test Suite**: Library tests use Karma/Jasmine but library is Vitest-compatible
### Angular Aria Compatibility
- โ
**ARIA Support**: Built-in ARIA attributes and screen reader support
- โ
**AriaLiveService**: Custom service for live region announcements
- โ
**Compatible**: Works alongside Angular Aria components
- โ
**Accessibility First**: All interactive elements have proper ARIA labels
## ๐ Additional Resources
- [Angular Signals Documentation](https://angular.dev/guide/signals)
- [Angular SSR Guide](https://angular.dev/guide/ssr)
- [Zoneless Angular Guide](https://angular.dev/guide/zoneless)
- [Signal Forms Documentation](https://angular.dev/guide/forms/signal-forms)
- [Angular Aria Documentation](https://angular.dev/guide/accessibility/angular-aria)
- [Vitest Documentation](https://vitest.dev/)
- [Angular Aria Documentation](https://angular.dev/guide/accessibility/angular-aria)
- [Vitest Documentation](https://vitest.dev/)
## ๐ Version Detection
To check your Angular version:
```bash
ng version
```
To verify compatibility:
```bash
npm list @angular/core @angular/common @angular/forms
```
## ๐ก Best Practices
1. **Use Signal Forms** (Angular 21+): Prefer `[field]` input for better integration
2. **Enable SSR**: Improves SEO and initial load performance
3. **Consider Zoneless**: Better performance, component is ready
4. **Use OnPush**: Already enabled, ensures optimal change detection
5. **Platform Checks**: Component handles SSR/CSR automatically
## ๐ Troubleshooting
### Issue: Component not updating in zoneless app
**Solution**: Component uses `markForCheck()` internally. Ensure you're using signals for reactive updates.
### Issue: SSR errors with DOM access
**Solution**: Component guards all DOM access. Check if you're using any custom code that accesses DOM directly.
### Issue: Signal Forms not working (Angular 21+)
**Solution**: Ensure you're using Angular 21+ and the `[field]` input with a signal form field.
### Issue: Translations not working in SSR
**Solution**: Translations work in SSR. Ensure locale is explicitly set if auto-detection fails on server.