@oneluiz/dual-datepicker 2.6.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.angular/cache/18.2.21/demo/angular-compiler.db +0 -0
- package/.angular/cache/18.2.21/demo/angular-compiler.db-lock +0 -0
- package/.nojekyll +0 -0
- package/CHANGELOG.md +254 -0
- package/GITHUB_PAGES.md +82 -0
- package/MIGRATION_V3.md +210 -0
- package/README.md +180 -89
- package/angular.json +75 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +925 -0
- package/dist/dual-datepicker.component.d.ts +101 -0
- package/dist/esm2022/dual-datepicker.component.mjs +448 -0
- package/{esm2022 → dist/esm2022}/public-api.mjs +1 -1
- package/dist/fesm2022/oneluiz-dual-datepicker.mjs +853 -0
- package/dist/fesm2022/oneluiz-dual-datepicker.mjs.map +1 -0
- package/{public-api.d.ts → dist/public-api.d.ts} +1 -1
- package/ng-package.json +7 -0
- package/package.json +24 -20
- package/dual-datepicker.component.d.ts +0 -91
- package/esm2022/dual-datepicker.component.mjs +0 -362
- package/fesm2022/oneluiz-dual-datepicker.mjs +0 -767
- package/fesm2022/oneluiz-dual-datepicker.mjs.map +0 -1
- /package/{date-adapter.d.ts → dist/date-adapter.d.ts} +0 -0
- /package/{esm2022 → dist/esm2022}/date-adapter.mjs +0 -0
- /package/{esm2022 → dist/esm2022}/native-date-adapter.mjs +0 -0
- /package/{esm2022 → dist/esm2022}/oneluiz-dual-datepicker.mjs +0 -0
- /package/{esm2022 → dist/esm2022}/preset-utils.mjs +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{native-date-adapter.d.ts → dist/native-date-adapter.d.ts} +0 -0
- /package/{preset-utils.d.ts → dist/preset-utils.d.ts} +0 -0
|
Binary file
|
|
Binary file
|
package/.nojekyll
ADDED
|
File without changes
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [3.0.0] - 2026-02-19
|
|
9
|
+
|
|
10
|
+
### 🚨 BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
#### Interface Property Renames (Spanish → English)
|
|
13
|
+
|
|
14
|
+
All `DateRange` interface properties have been renamed to English for better international adoption:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// v2.x (DEPRECATED)
|
|
18
|
+
interface DateRange {
|
|
19
|
+
fechaInicio: string;
|
|
20
|
+
fechaFin: string;
|
|
21
|
+
rangoTexto: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// v3.0.0 (NEW)
|
|
25
|
+
interface DateRange {
|
|
26
|
+
startDate: string;
|
|
27
|
+
endDate: string;
|
|
28
|
+
rangeText: string;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Migration**: Replace all references:
|
|
33
|
+
- `range.fechaInicio` → `range.startDate`
|
|
34
|
+
- `range.fechaFin` → `range.endDate`
|
|
35
|
+
- `range.rangoTexto` → `range.rangeText`
|
|
36
|
+
|
|
37
|
+
#### Component @Input Properties Renamed
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
// v2.x (DEPRECATED)
|
|
41
|
+
<ngx-dual-datepicker
|
|
42
|
+
[fechaInicio]="startDate"
|
|
43
|
+
[fechaFin]="endDate">
|
|
44
|
+
</ngx-dual-datepicker>
|
|
45
|
+
|
|
46
|
+
// v3.0.0 (NEW)
|
|
47
|
+
<ngx-dual-datepicker
|
|
48
|
+
[startDate]="startDate"
|
|
49
|
+
[endDate]="endDate">
|
|
50
|
+
</ngx-dual-datepicker>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### Deprecated `daysAgo` Pattern Removed
|
|
54
|
+
|
|
55
|
+
The deprecated `daysAgo` property has been completely removed from `PresetConfig`. You must now use the `getValue()` pattern:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
// v2.x (NO LONGER WORKS)
|
|
59
|
+
presets = [
|
|
60
|
+
{ label: 'Last 30 days', daysAgo: 30 }
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
// v3.0.0 (REQUIRED)
|
|
64
|
+
import { getLastNDays, CommonPresets } from '@oneluiz/dual-datepicker';
|
|
65
|
+
|
|
66
|
+
// Option 1: Use helper function
|
|
67
|
+
presets = [
|
|
68
|
+
{ label: 'Last 30 days', getValue: () => getLastNDays(30) }
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
// Option 2: Use pre-built collections
|
|
72
|
+
presets = CommonPresets.dashboard;
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Component Methods Renamed to English
|
|
76
|
+
|
|
77
|
+
All public methods have been renamed:
|
|
78
|
+
|
|
79
|
+
| v2.x | v3.0.0 |
|
|
80
|
+
|------|--------|
|
|
81
|
+
| `limpiar()` | `clear()` |
|
|
82
|
+
| `seleccionarDia()` | `selectDay()` |
|
|
83
|
+
| `cambiarMes()` | `changeMonth()` |
|
|
84
|
+
| `cerrarDatePicker()` | `closeDatePicker()` |
|
|
85
|
+
| `actualizarRangoFechasTexto()` | `updateDateRangeText()` |
|
|
86
|
+
| `generarCalendarios()` | `generateCalendars()` |
|
|
87
|
+
| `seleccionarRangoPredefinido()` | `selectPresetRange()` |
|
|
88
|
+
| `eliminarRango()` | `removeRange()` |
|
|
89
|
+
|
|
90
|
+
**Migration**: Update method calls:
|
|
91
|
+
```typescript
|
|
92
|
+
// v2.x
|
|
93
|
+
this.datepicker.limpiar();
|
|
94
|
+
|
|
95
|
+
// v3.0.0
|
|
96
|
+
this.datepicker.clear();
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### Signals Renamed to English
|
|
100
|
+
|
|
101
|
+
All internal signals have been renamed (only affects direct signal access):
|
|
102
|
+
|
|
103
|
+
- `mostrarDatePicker` → `showDatePicker`
|
|
104
|
+
- `rangoFechas` → `dateRangeText`
|
|
105
|
+
- `fechaSeleccionandoInicio` → `selectingStartDate`
|
|
106
|
+
- `mesActual` → `currentMonth`
|
|
107
|
+
- `mesAnterior` → `previousMonth`
|
|
108
|
+
- `diasMesActual` → `currentMonthDays`
|
|
109
|
+
- `diasMesAnterior` → `previousMonthDays`
|
|
110
|
+
- `nombreMesActual` → `currentMonthName`
|
|
111
|
+
- `nombreMesAnterior` → `previousMonthName`
|
|
112
|
+
- `diasSemana` → `weekDayNames`
|
|
113
|
+
|
|
114
|
+
### 📖 Migration Guide
|
|
115
|
+
|
|
116
|
+
See [MIGRATION_V3.md](MIGRATION_V3.md) for complete migration instructions including:
|
|
117
|
+
- Step-by-step migration checklist
|
|
118
|
+
- Find & replace patterns
|
|
119
|
+
- Before/after code examples
|
|
120
|
+
- Rollback instructions
|
|
121
|
+
|
|
122
|
+
### 🎯 Why These Changes?
|
|
123
|
+
|
|
124
|
+
1. **International Adoption**: English property names make the library more accessible to the global developer community
|
|
125
|
+
2. **TypeScript Best Practices**: Aligns with Angular and TypeScript naming conventions
|
|
126
|
+
3. **Maintainability**: Consistent English naming reduces cognitive overhead
|
|
127
|
+
4. **Technical Debt Elimination**: Removed deprecated `daysAgo` pattern that was replaced by more flexible `getValue()` in v2.6.0
|
|
128
|
+
|
|
129
|
+
### ✅ What's NOT Breaking
|
|
130
|
+
|
|
131
|
+
- All styling properties remain unchanged
|
|
132
|
+
- All output events remain unchanged (`dateRangeSelected`, `dateRangeChange`, `multiDateRangeSelected`)
|
|
133
|
+
- Component selector (`<ngx-dual-datepicker>`) unchanged
|
|
134
|
+
- `LocaleConfig` interface unchanged
|
|
135
|
+
- Multi-range functionality unchanged
|
|
136
|
+
- All visual behavior unchanged
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## [2.7.0] - 2026-02-15
|
|
141
|
+
|
|
142
|
+
### Added
|
|
143
|
+
|
|
144
|
+
- **Multi-Range Support**: Select multiple non-overlapping date ranges in a single picker
|
|
145
|
+
- New `multiRange` @Input property (boolean, default: false)
|
|
146
|
+
- New `multiDateRangeSelected` @Output event
|
|
147
|
+
- New `multiDateRangeChange` @Output event
|
|
148
|
+
- Visual indicators for multiple ranges
|
|
149
|
+
- Delete button for each range
|
|
150
|
+
- Validation to prevent overlapping ranges
|
|
151
|
+
- Perfect for booking systems, blackout dates, and complex scheduling
|
|
152
|
+
|
|
153
|
+
### Changed
|
|
154
|
+
|
|
155
|
+
- Updated GitHub Page Documentation tab with Multi-Range section
|
|
156
|
+
- Updated API Reference with new v2.7.0 properties
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## [2.6.0] - 2025-12-10
|
|
161
|
+
|
|
162
|
+
### Added
|
|
163
|
+
|
|
164
|
+
- **Flexible Preset System**: New `getValue()` pattern for dynamic presets
|
|
165
|
+
- Allows custom date calculation logic
|
|
166
|
+
- Helper functions: `getLastNDays()`, `getThisMonth()`, `getLastMonth()`, `getYearToDate()`
|
|
167
|
+
- Pre-built preset collections: `CommonPresets.simple`, `CommonPresets.dashboard`, `CommonPresets.analytics`
|
|
168
|
+
|
|
169
|
+
### Deprecated
|
|
170
|
+
|
|
171
|
+
- `daysAgo` property in `PresetConfig` (use `getValue()` instead)
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## [2.5.0] - 2025-10-05
|
|
176
|
+
|
|
177
|
+
### Added
|
|
178
|
+
|
|
179
|
+
- **Date Adapter System**: Support for third-party date libraries
|
|
180
|
+
- DayJS adapter
|
|
181
|
+
- date-fns adapter
|
|
182
|
+
- Luxon adapter
|
|
183
|
+
- Custom adapter interface
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## [2.4.0] - 2025-08-20
|
|
188
|
+
|
|
189
|
+
### Added
|
|
190
|
+
|
|
191
|
+
- **Reactive Forms Support**: Implement `ControlValueAccessor` interface
|
|
192
|
+
- Full Angular Forms integration
|
|
193
|
+
- Support for `ngModel`, `formControl`, `formControlName`
|
|
194
|
+
- Validation support
|
|
195
|
+
|
|
196
|
+
### Changed
|
|
197
|
+
|
|
198
|
+
- **Default `showClearButton` changed to `false`** (BREAKING CHANGE)
|
|
199
|
+
- Redesigned clear button with minimalist UI
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## [2.3.0] - 2025-06-15
|
|
204
|
+
|
|
205
|
+
### Added
|
|
206
|
+
|
|
207
|
+
- Spanish locale support
|
|
208
|
+
- Custom locale configuration
|
|
209
|
+
- Internationalization (i18n) infrastructure
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## [2.2.0] - 2025-04-10
|
|
214
|
+
|
|
215
|
+
### Added
|
|
216
|
+
|
|
217
|
+
- Preset ranges (`presetRanges` @Input)
|
|
218
|
+
- Auto-close on selection (`closeOnSelection` @Input)
|
|
219
|
+
- Auto-close on preset selection (`closeOnPresetSelection` @Input)
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## [2.1.0] - 2025-02-01
|
|
224
|
+
|
|
225
|
+
### Added
|
|
226
|
+
|
|
227
|
+
- Custom styling properties (16 CSS customization inputs)
|
|
228
|
+
- Theme support
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## [2.0.0] - 2024-12-15
|
|
233
|
+
|
|
234
|
+
### Added
|
|
235
|
+
|
|
236
|
+
- **Angular Signals**: Complete rewrite using Angular Signals for better reactivity and performance
|
|
237
|
+
- Standalone component architecture
|
|
238
|
+
- Zero dependencies
|
|
239
|
+
|
|
240
|
+
### Changed
|
|
241
|
+
|
|
242
|
+
- Minimum Angular version: 17.0.0 (BREAKING CHANGE)
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## [1.0.0] - 2024-10-01
|
|
247
|
+
|
|
248
|
+
### Added
|
|
249
|
+
|
|
250
|
+
- Initial release
|
|
251
|
+
- Basic date range picker functionality
|
|
252
|
+
- Dual calendar view
|
|
253
|
+
- Date range selection
|
|
254
|
+
- Custom date range text formatting
|
package/GITHUB_PAGES.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# GitHub Pages Setup
|
|
2
|
+
|
|
3
|
+
This project includes a live demo hosted on GitHub Pages.
|
|
4
|
+
|
|
5
|
+
## 🚀 Viewing the Demo
|
|
6
|
+
|
|
7
|
+
Visit [https://oneluiz.github.io/ng-dual-datepicker/](https://oneluiz.github.io/ng-dual-datepicker/) to see the component in action.
|
|
8
|
+
|
|
9
|
+
## 🛠️ Building the Demo Locally
|
|
10
|
+
|
|
11
|
+
To build and preview the demo locally:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install dependencies
|
|
15
|
+
npm install
|
|
16
|
+
|
|
17
|
+
# Serve the demo locally
|
|
18
|
+
npm run demo:serve
|
|
19
|
+
|
|
20
|
+
# Build the demo for production
|
|
21
|
+
npm run demo:build
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The built demo will be placed in the `docs/` directory, which is configured for GitHub Pages deployment.
|
|
25
|
+
|
|
26
|
+
## 📝 GitHub Pages Configuration
|
|
27
|
+
|
|
28
|
+
To enable GitHub Pages for this repository:
|
|
29
|
+
|
|
30
|
+
1. Go to your repository settings on GitHub
|
|
31
|
+
2. Navigate to **Pages** in the left sidebar
|
|
32
|
+
3. Under **Source**, select:
|
|
33
|
+
- **Branch**: `main` (or your default branch)
|
|
34
|
+
- **Folder**: `/docs`
|
|
35
|
+
4. Click **Save**
|
|
36
|
+
5. Your site will be published at `https://[username].github.io/ng-dual-datepicker/`
|
|
37
|
+
|
|
38
|
+
## 🔄 Updating the Demo
|
|
39
|
+
|
|
40
|
+
After making changes to the demo:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Rebuild the demo
|
|
44
|
+
npm run demo:build
|
|
45
|
+
|
|
46
|
+
# Move files from browser subfolder to docs root
|
|
47
|
+
cd docs && mv browser/* . && rm -r browser && cd ..
|
|
48
|
+
|
|
49
|
+
# Commit and push changes
|
|
50
|
+
git add docs/
|
|
51
|
+
git commit -m "Update demo"
|
|
52
|
+
git push
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
GitHub Pages will automatically deploy the updated demo within a few minutes.
|
|
56
|
+
|
|
57
|
+
## 📁 Project Structure
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
ng-dual-datepicker/
|
|
61
|
+
├── src/ # Source code for the component
|
|
62
|
+
├── demo/ # Demo application source
|
|
63
|
+
│ └── src/
|
|
64
|
+
│ ├── app/ # Demo app components
|
|
65
|
+
│ ├── index.html # Demo HTML template
|
|
66
|
+
│ └── styles.scss # Demo styles
|
|
67
|
+
├── docs/ # Built demo (GitHub Pages)
|
|
68
|
+
│ ├── .nojekyll # Tells GitHub not to use Jekyll
|
|
69
|
+
│ ├── index.html
|
|
70
|
+
│ └── *.js, *.css # Compiled assets
|
|
71
|
+
└── dist/ # Built library package
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 🎨 Customizing the Demo
|
|
75
|
+
|
|
76
|
+
The demo source code is in `demo/src/app/`. You can:
|
|
77
|
+
|
|
78
|
+
- Edit `app.component.html` to change the layout
|
|
79
|
+
- Edit `app.component.ts` to add new examples
|
|
80
|
+
- Edit `app.component.scss` or `styles.scss` for styling
|
|
81
|
+
|
|
82
|
+
After making changes, rebuild with `npm run demo:build`.
|
package/MIGRATION_V3.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Migration Guide: v2.x → v3.0.0
|
|
2
|
+
|
|
3
|
+
## ⚠️ BREAKING CHANGES
|
|
4
|
+
|
|
5
|
+
Version 3.0.0 is a major refactoring that removes deprecated features and translates all Spanish property names to English for better international adoption and code maintainability.
|
|
6
|
+
|
|
7
|
+
## 1. DateRange Interface Changes
|
|
8
|
+
|
|
9
|
+
**All properties renamed from Spanish to English:**
|
|
10
|
+
|
|
11
|
+
### Before (v2.x):
|
|
12
|
+
```typescript
|
|
13
|
+
interface DateRange {
|
|
14
|
+
fechaInicio: string;
|
|
15
|
+
fechaFin: string;
|
|
16
|
+
rangoTexto: string;
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### After (v3.0.0):
|
|
21
|
+
```typescript
|
|
22
|
+
interface DateRange {
|
|
23
|
+
startDate: string;
|
|
24
|
+
endDate: string;
|
|
25
|
+
rangeText: string;
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Migration:**
|
|
30
|
+
```typescript
|
|
31
|
+
// OLD
|
|
32
|
+
const range: DateRange = {
|
|
33
|
+
fechaInicio: '2026-01-01',
|
|
34
|
+
fechaFin: '2026-01-31',
|
|
35
|
+
rangoTexto: 'Jan 1 - Jan 31'
|
|
36
|
+
};
|
|
37
|
+
console.log(range.fechaInicio); // OLD
|
|
38
|
+
|
|
39
|
+
// NEW
|
|
40
|
+
const range: DateRange = {
|
|
41
|
+
startDate: '2026-01-01',
|
|
42
|
+
endDate: '2026-01-31',
|
|
43
|
+
rangeText: 'Jan 1 - Jan 31'
|
|
44
|
+
};
|
|
45
|
+
console.log(range.startDate); // NEW
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 2. Component @Input Properties
|
|
49
|
+
|
|
50
|
+
### Before (v2.x):
|
|
51
|
+
```html
|
|
52
|
+
<ngx-dual-datepicker
|
|
53
|
+
[fechaInicio]="startValue"
|
|
54
|
+
[fechaFin]="endValue">
|
|
55
|
+
</ngx-dual-datepicker>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### After (v3.0.0):
|
|
59
|
+
```html
|
|
60
|
+
<ngx-dual-datepicker
|
|
61
|
+
[startDate]="startValue"
|
|
62
|
+
[endDate]="endValue">
|
|
63
|
+
</ngx-dual-datepicker>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 3. PresetConfig - Removed Deprecated `daysAgo`
|
|
67
|
+
|
|
68
|
+
**The deprecated `daysAgo` pattern has been completely removed.**
|
|
69
|
+
|
|
70
|
+
### Before (v2.x):
|
|
71
|
+
```typescript
|
|
72
|
+
// This NO LONGER WORKS in v3.0.0
|
|
73
|
+
presets: PresetConfig[] = [
|
|
74
|
+
{ label: 'Last 30 days', daysAgo: 30 } // ❌ REMOVED
|
|
75
|
+
];
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### After (v3.0.0):
|
|
79
|
+
```typescript
|
|
80
|
+
import { getLastNDays } from '@oneluiz/dual-datepicker';
|
|
81
|
+
|
|
82
|
+
presets: PresetConfig[] = [
|
|
83
|
+
{ label: 'Last 30 days', getValue: () => getLastNDays(30) } // ✅ REQUIRED
|
|
84
|
+
];
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Or use pre-built CommonPresets:**
|
|
88
|
+
```typescript
|
|
89
|
+
import { CommonPresets } from '@oneluiz/dual-datepicker';
|
|
90
|
+
|
|
91
|
+
presets = CommonPresets.dashboard; // ✅ Already uses getValue()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 4. Event Handler Updates
|
|
95
|
+
|
|
96
|
+
### Before (v2.x):
|
|
97
|
+
```typescript
|
|
98
|
+
onDateRangeChange(range: DateRange) {
|
|
99
|
+
console.log('Start:', range.fechaInicio);
|
|
100
|
+
console.log('End:', range.fechaFin);
|
|
101
|
+
console.log('Text:', range.rangoTexto);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### After (v3.0.0):
|
|
106
|
+
```typescript
|
|
107
|
+
onDateRangeChange(range: DateRange) {
|
|
108
|
+
console.log('Start:', range.startDate);
|
|
109
|
+
console.log('End:', range.endDate);
|
|
110
|
+
console.log('Text:', range.rangeText);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 5. Multi-Range Interface Updates
|
|
115
|
+
|
|
116
|
+
### Before (v2.x):
|
|
117
|
+
```typescript
|
|
118
|
+
onMultiRangeChange(data: MultiDateRange) {
|
|
119
|
+
data.ranges.forEach(range => {
|
|
120
|
+
console.log(range.fechaInicio, range.fechaFin); // OLD
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### After (v3.0.0):
|
|
126
|
+
```typescript
|
|
127
|
+
onMultiRangeChange(data: MultiDateRange) {
|
|
128
|
+
data.ranges.forEach(range => {
|
|
129
|
+
console.log(range.startDate, range.endDate); // NEW
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## 6. Reactive Forms / ControlValueAccessor
|
|
135
|
+
|
|
136
|
+
### Before (v2.x):
|
|
137
|
+
```typescript
|
|
138
|
+
this.form.patchValue({
|
|
139
|
+
dateRange: {
|
|
140
|
+
fechaInicio: '2026-01-01',
|
|
141
|
+
fechaFin: '2026-01-31',
|
|
142
|
+
rangoTexto: 'Jan 1 - Jan 31'
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### After (v3.0.0):
|
|
148
|
+
```typescript
|
|
149
|
+
this.form.patchValue({
|
|
150
|
+
dateRange: {
|
|
151
|
+
startDate: '2026-01-01',
|
|
152
|
+
endDate: '2026-01-31',
|
|
153
|
+
rangeText: 'Jan 1 - Jan 31'
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Quick Migration Checklist
|
|
159
|
+
|
|
160
|
+
- [ ] Replace `fechaInicio` with `startDate` in all templates
|
|
161
|
+
- [ ] Replace `fechaFin` with `endDate` in all templates
|
|
162
|
+
- [ ] Replace `rangoTexto` with `rangeText` in all templates
|
|
163
|
+
- [ ] Update `@Input()` bindings: `[fechaInicio]` → `[startDate]`, `[fechaFin]` → `[endDate]`
|
|
164
|
+
- [ ] Update all `DateRange` property references in TypeScript
|
|
165
|
+
- [ ] Remove all `daysAgo` usage and replace with `getValue: () => getLastNDays(n)`
|
|
166
|
+
- [ ] Update presets to use `getValue` functions or CommonPresets
|
|
167
|
+
- [ ] Update event handlers accessing `DateRange` properties
|
|
168
|
+
- [ ] Update form control value accessors
|
|
169
|
+
- [ ] Test multi-range functionality if used
|
|
170
|
+
|
|
171
|
+
## Automated Migration (Find & Replace)
|
|
172
|
+
|
|
173
|
+
You can use these find & replace patterns in your codebase:
|
|
174
|
+
|
|
175
|
+
1. **TypeScript files (*.ts):**
|
|
176
|
+
- `fechaInicio` → `startDate`
|
|
177
|
+
- `fechaFin` → `endDate`
|
|
178
|
+
- `rangoTexto` → `rangeText`
|
|
179
|
+
- `daysAgo:` → Remove and replace with `getValue: () => getLastNDays(...)`
|
|
180
|
+
|
|
181
|
+
2. **HTML Templates (*.html):**
|
|
182
|
+
- `[fechaInicio]` → `[startDate]`
|
|
183
|
+
- `[fechaFin]` → `[endDate]`
|
|
184
|
+
- `range.fechaInicio` → `range.startDate`
|
|
185
|
+
- `range.fechaFin` → `range.endDate`
|
|
186
|
+
- `range.rangoTexto` → `range.rangeText`
|
|
187
|
+
|
|
188
|
+
## Why This Change?
|
|
189
|
+
|
|
190
|
+
1. **International Adoption**: English property names make the library more accessible globally
|
|
191
|
+
2. **Code Maintainability**: Consistent naming conventions across the codebase
|
|
192
|
+
3. **Professional Standard**: Aligns with TypeScript/Angular conventions
|
|
193
|
+
4. **Remove Technical Debt**: Eliminates deprecated `daysAgo` pattern
|
|
194
|
+
5. **Cleaner API**: More intuitive and self-documenting code
|
|
195
|
+
|
|
196
|
+
## Need Help?
|
|
197
|
+
|
|
198
|
+
- 📖 [Full Documentation](https://oneluiz.github.io/ng-dual-datepicker/)
|
|
199
|
+
- 🐛 [Report Issues](https://github.com/oneluiz/ng-dual-datepicker/issues)
|
|
200
|
+
- 💬 [Discussions](https://github.com/oneluiz/ng-dual-datepicker/discussions)
|
|
201
|
+
|
|
202
|
+
## Rollback to v2.x
|
|
203
|
+
|
|
204
|
+
If you need more time to migrate, you can stay on v2.7.0:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npm install @oneluiz/dual-datepicker@2.7.0
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Version 2.7.0 will continue to work but will not receive new features.
|