ngx-datex 1.0.0 → 1.0.1
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/fesm2022/ngx-datex.mjs +488 -58
- package/fesm2022/ngx-datex.mjs.map +1 -0
- package/package.json +1 -1
- package/types/ngx-datex.d.ts +441 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-datex",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Modern Angular date range picker with Material Design featuring signals, control flow syntax, time picker, themes, and responsive design for Angular 21+",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@angular/animations": "^21.1.1",
|
package/types/ngx-datex.d.ts
CHANGED
|
@@ -137,11 +137,11 @@ interface NgxDatexTheme {
|
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Configuration options for date picker behavior and validation.
|
|
140
|
+
* Note: Date format is configured in NgxDatexLocale.format, not here.
|
|
140
141
|
*
|
|
141
142
|
* @example
|
|
142
143
|
* ```typescript
|
|
143
144
|
* const config: NgxDatexConfig = {
|
|
144
|
-
* dateFormat: 'DD/MM/YYYY',
|
|
145
145
|
* firstDayOfWeek: 1, // Monday
|
|
146
146
|
* businessDaysOnly: true,
|
|
147
147
|
* closeOnSelect: false
|
|
@@ -149,8 +149,6 @@ interface NgxDatexTheme {
|
|
|
149
149
|
* ```
|
|
150
150
|
*/
|
|
151
151
|
interface NgxDatexConfig {
|
|
152
|
-
/** Date format string (default: 'DD/MM/YYYY') */
|
|
153
|
-
dateFormat?: string;
|
|
154
152
|
/** First day of week (0 = Sunday, 1 = Monday, etc.) */
|
|
155
153
|
firstDayOfWeek?: number;
|
|
156
154
|
/** Whether to show week numbers in calendar */
|
|
@@ -172,22 +170,206 @@ interface NgxDatexConfig {
|
|
|
172
170
|
* Localization configuration for the date picker.
|
|
173
171
|
* Controls language, date formats, and UI text.
|
|
174
172
|
*
|
|
173
|
+
* The `format` property is the primary way to control date formatting,
|
|
174
|
+
* following the vanilla-daterangepicker pattern.
|
|
175
|
+
*
|
|
175
176
|
* @example
|
|
176
177
|
* ```typescript
|
|
178
|
+
* // Basic date-only formats
|
|
177
179
|
* const spanishLocale: NgxDatexLocale = {
|
|
178
|
-
*
|
|
179
|
-
* format: 'DD/MM/YYYY',
|
|
180
|
+
* locale: 'es-ES',
|
|
181
|
+
* format: 'DD/MM/YYYY', // 15/01/2024
|
|
182
|
+
* separator: ' - ',
|
|
180
183
|
* daysOfWeek: ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do'],
|
|
181
184
|
* monthNames: ['Enero', 'Febrero', 'Marzo', ...],
|
|
182
185
|
* applyLabel: 'Aplicar',
|
|
183
186
|
* cancelLabel: 'Cancelar'
|
|
184
187
|
* };
|
|
188
|
+
*
|
|
189
|
+
* const americanLocale: NgxDatexLocale = {
|
|
190
|
+
* locale: 'en-US',
|
|
191
|
+
* format: 'MM/DD/YYYY', // 01/15/2024
|
|
192
|
+
* separator: ' - ',
|
|
193
|
+
* daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
194
|
+
* monthNames: ['January', 'February', 'March', ...],
|
|
195
|
+
* applyLabel: 'Apply',
|
|
196
|
+
* cancelLabel: 'Cancel'
|
|
197
|
+
* };
|
|
198
|
+
*
|
|
199
|
+
* // Time picker formats (when timePicker=true)
|
|
200
|
+
* const spanishWithTime24h: NgxDatexLocale = {
|
|
201
|
+
* locale: 'es-ES',
|
|
202
|
+
* format: 'DD/MM/YYYY HH:mm', // 15/01/2024 14:30
|
|
203
|
+
* // ... other properties
|
|
204
|
+
* };
|
|
205
|
+
*
|
|
206
|
+
* const americanWithTime12h: NgxDatexLocale = {
|
|
207
|
+
* locale: 'en-US',
|
|
208
|
+
* format: 'MM/DD/YYYY hh:mm A', // 01/15/2024 02:30 PM
|
|
209
|
+
* // ... other properties
|
|
210
|
+
* };
|
|
211
|
+
*
|
|
212
|
+
* // ISO format for APIs
|
|
213
|
+
* const isoFormat: NgxDatexLocale = {
|
|
214
|
+
* locale: 'en-US',
|
|
215
|
+
* format: 'YYYY-MM-DD', // 2024-01-15
|
|
216
|
+
* // ... other properties
|
|
217
|
+
* };
|
|
218
|
+
*
|
|
219
|
+
* const isoWithTime: NgxDatexLocale = {
|
|
220
|
+
* locale: 'en-US',
|
|
221
|
+
* format: 'YYYY-MM-DD HH:mm', // 2024-01-15 14:30
|
|
222
|
+
* // ... other properties
|
|
223
|
+
* };
|
|
185
224
|
* ```
|
|
186
225
|
*/
|
|
187
226
|
interface NgxDatexLocale {
|
|
227
|
+
/**
|
|
228
|
+
* Locale string for date formatting and internationalization.
|
|
229
|
+
* Used by @formkit/tempo for proper locale-aware formatting.
|
|
230
|
+
*
|
|
231
|
+
* This affects how dates are formatted according to regional conventions,
|
|
232
|
+
* including number formatting, month/day names, and cultural preferences.
|
|
233
|
+
*
|
|
234
|
+
* ## Common Locale Codes:
|
|
235
|
+
* - `'es-ES'` - Spanish (Spain)
|
|
236
|
+
* - `'es-MX'` - Spanish (Mexico)
|
|
237
|
+
* - `'en-US'` - English (United States)
|
|
238
|
+
* - `'en-GB'` - English (United Kingdom)
|
|
239
|
+
* - `'fr-FR'` - French (France)
|
|
240
|
+
* - `'de-DE'` - German (Germany)
|
|
241
|
+
* - `'it-IT'` - Italian (Italy)
|
|
242
|
+
* - `'pt-BR'` - Portuguese (Brazil)
|
|
243
|
+
* - `'ja-JP'` - Japanese (Japan)
|
|
244
|
+
* - `'zh-CN'` - Chinese (Simplified)
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* // Spanish locale
|
|
249
|
+
* const spanishLocale: NgxDatexLocale = {
|
|
250
|
+
* locale: 'es-ES',
|
|
251
|
+
* format: 'DD/MM/YYYY'
|
|
252
|
+
* };
|
|
253
|
+
*
|
|
254
|
+
* // US English locale
|
|
255
|
+
* const usLocale: NgxDatexLocale = {
|
|
256
|
+
* locale: 'en-US',
|
|
257
|
+
* format: 'MM/DD/YYYY'
|
|
258
|
+
* };
|
|
259
|
+
*
|
|
260
|
+
* // German locale
|
|
261
|
+
* const germanLocale: NgxDatexLocale = {
|
|
262
|
+
* locale: 'de-DE',
|
|
263
|
+
* format: 'DD.MM.YYYY'
|
|
264
|
+
* };
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @default undefined (uses browser default)
|
|
268
|
+
*/
|
|
269
|
+
locale?: string;
|
|
188
270
|
/** Text direction for RTL languages */
|
|
189
271
|
direction?: 'ltr' | 'rtl';
|
|
190
|
-
/**
|
|
272
|
+
/**
|
|
273
|
+
* Primary date format string using @formkit/tempo tokens.
|
|
274
|
+
* This format is used for ALL date display and parsing in the component.
|
|
275
|
+
*
|
|
276
|
+
* **IMPORTANT**: When using timePicker=true, you MUST include time tokens in the format.
|
|
277
|
+
* The component does NOT automatically add time formatting - you must specify it explicitly.
|
|
278
|
+
*
|
|
279
|
+
* ## Available Format Tokens:
|
|
280
|
+
*
|
|
281
|
+
* ### Date Tokens:
|
|
282
|
+
* - `YYYY` - 4 digit year (2024)
|
|
283
|
+
* - `YY` - 2 digit year (24)
|
|
284
|
+
* - `MM` - 2 digit month (01-12)
|
|
285
|
+
* - `M` - 1-2 digit month (1-12)
|
|
286
|
+
* - `DD` - 2 digit day (01-31)
|
|
287
|
+
* - `D` - 1-2 digit day (1-31)
|
|
288
|
+
*
|
|
289
|
+
* ### Time Tokens (24-hour):
|
|
290
|
+
* - `HH` - 2 digit hour 24-hour format (00-23)
|
|
291
|
+
* - `H` - 1-2 digit hour 24-hour format (0-23)
|
|
292
|
+
* - `mm` - 2 digit minutes (00-59)
|
|
293
|
+
* - `m` - 1-2 digit minutes (0-59)
|
|
294
|
+
* - `ss` - 2 digit seconds (00-59)
|
|
295
|
+
* - `s` - 1-2 digit seconds (0-59)
|
|
296
|
+
*
|
|
297
|
+
* ### Time Tokens (12-hour):
|
|
298
|
+
* - `hh` - 2 digit hour 12-hour format (01-12)
|
|
299
|
+
* - `h` - 1-2 digit hour 12-hour format (1-12)
|
|
300
|
+
* - `A` - AM/PM uppercase
|
|
301
|
+
* - `a` - am/pm lowercase
|
|
302
|
+
*
|
|
303
|
+
* ## Common Format Examples:
|
|
304
|
+
*
|
|
305
|
+
* ### Date Only Formats:
|
|
306
|
+
* ```typescript
|
|
307
|
+
* format: 'DD/MM/YYYY' // 15/01/2024 (European)
|
|
308
|
+
* format: 'MM/DD/YYYY' // 01/15/2024 (US)
|
|
309
|
+
* format: 'YYYY-MM-DD' // 2024-01-15 (ISO)
|
|
310
|
+
* format: 'D/M/YYYY' // 15/1/2024 (no leading zeros)
|
|
311
|
+
* format: 'DD-MM-YY' // 15-01-24 (short year)
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* ### Date + Time Formats (24-hour):
|
|
315
|
+
* ```typescript
|
|
316
|
+
* format: 'DD/MM/YYYY HH:mm' // 15/01/2024 14:30
|
|
317
|
+
* format: 'MM/DD/YYYY HH:mm' // 01/15/2024 14:30
|
|
318
|
+
* format: 'YYYY-MM-DD HH:mm' // 2024-01-15 14:30
|
|
319
|
+
* format: 'DD/MM/YYYY HH:mm:ss' // 15/01/2024 14:30:45
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* ### Date + Time Formats (12-hour):
|
|
323
|
+
* ```typescript
|
|
324
|
+
* format: 'DD/MM/YYYY hh:mm A' // 15/01/2024 02:30 PM
|
|
325
|
+
* format: 'MM/DD/YYYY hh:mm A' // 01/15/2024 02:30 PM
|
|
326
|
+
* format: 'DD/MM/YYYY h:mm a' // 15/01/2024 2:30 pm
|
|
327
|
+
* ```
|
|
328
|
+
*
|
|
329
|
+
* ## Usage with TimePicker:
|
|
330
|
+
*
|
|
331
|
+
* ```typescript
|
|
332
|
+
* // ❌ WRONG - Will only show date even with timePicker=true
|
|
333
|
+
* const wrongLocale: NgxDatexLocale = {
|
|
334
|
+
* format: 'DD/MM/YYYY' // Missing time format!
|
|
335
|
+
* };
|
|
336
|
+
*
|
|
337
|
+
* // ✅ CORRECT - Includes time format for timePicker=true
|
|
338
|
+
* const correctLocale24h: NgxDatexLocale = {
|
|
339
|
+
* format: 'DD/MM/YYYY HH:mm' // Shows: 15/01/2024 14:30
|
|
340
|
+
* };
|
|
341
|
+
*
|
|
342
|
+
* const correctLocale12h: NgxDatexLocale = {
|
|
343
|
+
* format: 'DD/MM/YYYY hh:mm A' // Shows: 15/01/2024 02:30 PM
|
|
344
|
+
* };
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* ## Component Usage Examples:
|
|
348
|
+
*
|
|
349
|
+
* ```html
|
|
350
|
+
* <!-- Date only picker -->
|
|
351
|
+
* <ngx-datex
|
|
352
|
+
* [locale]="{ format: 'DD/MM/YYYY' }"
|
|
353
|
+
* [timePicker]="false">
|
|
354
|
+
* </ngx-datex>
|
|
355
|
+
*
|
|
356
|
+
* <!-- Date + time picker (24h) -->
|
|
357
|
+
* <ngx-datex
|
|
358
|
+
* [locale]="{ format: 'DD/MM/YYYY HH:mm' }"
|
|
359
|
+
* [timePicker]="true"
|
|
360
|
+
* [timePicker24Hour]="true">
|
|
361
|
+
* </ngx-datex>
|
|
362
|
+
*
|
|
363
|
+
* <!-- Date + time picker (12h) -->
|
|
364
|
+
* <ngx-datex
|
|
365
|
+
* [locale]="{ format: 'MM/DD/YYYY hh:mm A' }"
|
|
366
|
+
* [timePicker]="true"
|
|
367
|
+
* [timePicker24Hour]="false">
|
|
368
|
+
* </ngx-datex>
|
|
369
|
+
* ```
|
|
370
|
+
*
|
|
371
|
+
* @default 'DD/MM/YYYY'
|
|
372
|
+
*/
|
|
191
373
|
format?: string;
|
|
192
374
|
/** Separator between start and end dates */
|
|
193
375
|
separator?: string;
|
|
@@ -371,28 +553,165 @@ declare class NgxDatex implements OnInit, OnDestroy, ControlValueAccessor {
|
|
|
371
553
|
* @example
|
|
372
554
|
* ```typescript
|
|
373
555
|
* const config: NgxDatexConfig = {
|
|
374
|
-
* dateFormat: 'DD/MM/YYYY',
|
|
375
556
|
* firstDayOfWeek: 1,
|
|
376
|
-
* businessDaysOnly: true
|
|
557
|
+
* businessDaysOnly: true,
|
|
558
|
+
* showWeekNumbers: true
|
|
377
559
|
* };
|
|
378
560
|
* ```
|
|
379
561
|
*/
|
|
380
562
|
config: _angular_core.InputSignal<NgxDatexConfig>;
|
|
381
563
|
/**
|
|
382
564
|
* Localization settings for internationalization.
|
|
383
|
-
* Controls language, date formats, and
|
|
565
|
+
* Controls language, date formats, UI text, and regional preferences.
|
|
566
|
+
*
|
|
567
|
+
* This is the primary configuration for adapting the date picker to different
|
|
568
|
+
* languages, regions, and cultural conventions. The most important property
|
|
569
|
+
* is `format`, which controls how dates are displayed and parsed.
|
|
384
570
|
*
|
|
385
571
|
* @default SPANISH_LOCALE
|
|
386
572
|
*
|
|
387
|
-
*
|
|
573
|
+
* ## Key Properties:
|
|
574
|
+
*
|
|
575
|
+
* - **`format`**: Date format string (REQUIRED for timePicker usage)
|
|
576
|
+
* - **`locale`**: Locale code for @formkit/tempo formatting
|
|
577
|
+
* - **`separator`**: Text between start and end dates
|
|
578
|
+
* - **`daysOfWeek`**: Short day names array
|
|
579
|
+
* - **`monthNames`**: Full month names array
|
|
580
|
+
* - **`applyLabel`**: Apply button text
|
|
581
|
+
* - **`cancelLabel`**: Cancel button text
|
|
582
|
+
*
|
|
583
|
+
* ## Format Examples:
|
|
584
|
+
*
|
|
585
|
+
* ### Date Only Formats:
|
|
388
586
|
* ```typescript
|
|
587
|
+
* // European format (DD/MM/YYYY)
|
|
588
|
+
* const europeanLocale: NgxDatexLocale = {
|
|
589
|
+
* locale: 'es-ES',
|
|
590
|
+
* format: 'DD/MM/YYYY', // 15/01/2024
|
|
591
|
+
* separator: ' - ',
|
|
592
|
+
* daysOfWeek: ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do'],
|
|
593
|
+
* monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio',
|
|
594
|
+
* 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
|
|
595
|
+
* applyLabel: 'Aplicar',
|
|
596
|
+
* cancelLabel: 'Cancelar',
|
|
597
|
+
* firstDay: 1 // Monday first
|
|
598
|
+
* };
|
|
599
|
+
*
|
|
600
|
+
* // US format (MM/DD/YYYY)
|
|
601
|
+
* const usLocale: NgxDatexLocale = {
|
|
602
|
+
* locale: 'en-US',
|
|
603
|
+
* format: 'MM/DD/YYYY', // 01/15/2024
|
|
604
|
+
* separator: ' - ',
|
|
605
|
+
* daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
606
|
+
* monthNames: ['January', 'February', 'March', 'April', 'May', 'June',
|
|
607
|
+
* 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
608
|
+
* applyLabel: 'Apply',
|
|
609
|
+
* cancelLabel: 'Cancel',
|
|
610
|
+
* firstDay: 0 // Sunday first
|
|
611
|
+
* };
|
|
612
|
+
*
|
|
613
|
+
* // ISO format (YYYY-MM-DD)
|
|
614
|
+
* const isoLocale: NgxDatexLocale = {
|
|
615
|
+
* locale: 'en-US',
|
|
616
|
+
* format: 'YYYY-MM-DD', // 2024-01-15
|
|
617
|
+
* separator: ' / ',
|
|
618
|
+
* daysOfWeek: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
|
|
619
|
+
* monthNames: ['January', 'February', 'March', 'April', 'May', 'June',
|
|
620
|
+
* 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
621
|
+
* applyLabel: 'Apply',
|
|
622
|
+
* cancelLabel: 'Cancel',
|
|
623
|
+
* firstDay: 1 // Monday first
|
|
624
|
+
* };
|
|
625
|
+
* ```
|
|
626
|
+
*
|
|
627
|
+
* ### Time Picker Formats:
|
|
628
|
+
* ```typescript
|
|
629
|
+
* // Spanish with 24-hour time
|
|
630
|
+
* const spanishWithTime: NgxDatexLocale = {
|
|
631
|
+
* locale: 'es-ES',
|
|
632
|
+
* format: 'DD/MM/YYYY HH:mm', // 15/01/2024 14:30
|
|
633
|
+
* separator: ' - ',
|
|
634
|
+
* daysOfWeek: ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do'],
|
|
635
|
+
* monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio',
|
|
636
|
+
* 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
|
|
637
|
+
* applyLabel: 'Aplicar',
|
|
638
|
+
* cancelLabel: 'Cancelar'
|
|
639
|
+
* };
|
|
640
|
+
*
|
|
641
|
+
* // US with 12-hour time
|
|
642
|
+
* const usWithTime: NgxDatexLocale = {
|
|
643
|
+
* locale: 'en-US',
|
|
644
|
+
* format: 'MM/DD/YYYY hh:mm A', // 01/15/2024 02:30 PM
|
|
645
|
+
* separator: ' - ',
|
|
646
|
+
* daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
647
|
+
* monthNames: ['January', 'February', 'March', 'April', 'May', 'June',
|
|
648
|
+
* 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
649
|
+
* applyLabel: 'Apply',
|
|
650
|
+
* cancelLabel: 'Cancel'
|
|
651
|
+
* };
|
|
652
|
+
*
|
|
653
|
+
* // French locale
|
|
389
654
|
* const frenchLocale: NgxDatexLocale = {
|
|
655
|
+
* locale: 'fr-FR',
|
|
390
656
|
* format: 'DD/MM/YYYY',
|
|
657
|
+
* separator: ' au ',
|
|
391
658
|
* daysOfWeek: ['Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa', 'Di'],
|
|
659
|
+
* monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin',
|
|
660
|
+
* 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
|
392
661
|
* applyLabel: 'Appliquer',
|
|
393
|
-
* cancelLabel: 'Annuler'
|
|
662
|
+
* cancelLabel: 'Annuler',
|
|
663
|
+
* customRangeLabel: 'Plage personnalisée',
|
|
664
|
+
* firstDay: 1
|
|
665
|
+
* };
|
|
666
|
+
*
|
|
667
|
+
* // German locale
|
|
668
|
+
* const germanLocale: NgxDatexLocale = {
|
|
669
|
+
* locale: 'de-DE',
|
|
670
|
+
* format: 'DD.MM.YYYY',
|
|
671
|
+
* separator: ' bis ',
|
|
672
|
+
* daysOfWeek: ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'],
|
|
673
|
+
* monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni',
|
|
674
|
+
* 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
|
|
675
|
+
* applyLabel: 'Anwenden',
|
|
676
|
+
* cancelLabel: 'Abbrechen',
|
|
677
|
+
* customRangeLabel: 'Benutzerdefiniert',
|
|
678
|
+
* firstDay: 1
|
|
394
679
|
* };
|
|
395
680
|
* ```
|
|
681
|
+
*
|
|
682
|
+
* ## Component Usage:
|
|
683
|
+
* ```html
|
|
684
|
+
* <!-- Spanish date picker -->
|
|
685
|
+
* <ngx-datex [locale]="spanishLocale"></ngx-datex>
|
|
686
|
+
*
|
|
687
|
+
* <!-- US date picker with time -->
|
|
688
|
+
* <ngx-datex
|
|
689
|
+
* [locale]="usWithTime"
|
|
690
|
+
* [timePicker]="true"
|
|
691
|
+
* [timePicker24Hour]="false">
|
|
692
|
+
* </ngx-datex>
|
|
693
|
+
*
|
|
694
|
+
* <!-- French date picker -->
|
|
695
|
+
* <ngx-datex [locale]="frenchLocale"></ngx-datex>
|
|
696
|
+
*
|
|
697
|
+
* <!-- Using predefined locales -->
|
|
698
|
+
* <ngx-datex [locale]="SPANISH_LOCALE"></ngx-datex>
|
|
699
|
+
* <ngx-datex [locale]="US_ENGLISH_LOCALE"></ngx-datex>
|
|
700
|
+
* <ngx-datex [locale]="SPANISH_LOCALE_WITH_TIME"></ngx-datex>
|
|
701
|
+
* ```
|
|
702
|
+
*
|
|
703
|
+
* ## Important Notes:
|
|
704
|
+
*
|
|
705
|
+
* 1. **TimePicker Format**: When `timePicker=true`, you MUST include time tokens in the format
|
|
706
|
+
* 2. **Locale Code**: The `locale` property affects @formkit/tempo formatting behavior
|
|
707
|
+
* 3. **Day Order**: `daysOfWeek` array should match your `firstDay` setting
|
|
708
|
+
* 4. **Separator**: Used between start and end dates in range display
|
|
709
|
+
* 5. **Predefined Locales**: Use exported constants like `SPANISH_LOCALE`, `US_ENGLISH_LOCALE`
|
|
710
|
+
*
|
|
711
|
+
* @see {@link NgxDatexLocale} for complete interface documentation
|
|
712
|
+
* @see {@link SPANISH_LOCALE} for default Spanish configuration
|
|
713
|
+
* @see {@link US_ENGLISH_LOCALE} for US English configuration
|
|
714
|
+
* @see {@link SPANISH_LOCALE_WITH_TIME} for Spanish with time support
|
|
396
715
|
*/
|
|
397
716
|
locale: _angular_core.InputSignal<NgxDatexLocale>;
|
|
398
717
|
/**
|
|
@@ -1528,6 +1847,74 @@ declare class NgxDatex implements OnInit, OnDestroy, ControlValueAccessor {
|
|
|
1528
1847
|
* ```
|
|
1529
1848
|
*/
|
|
1530
1849
|
declare const SPANISH_LOCALE: NgxDatexLocale;
|
|
1850
|
+
/**
|
|
1851
|
+
* Spanish locale with time picker support (24-hour format).
|
|
1852
|
+
*
|
|
1853
|
+
* Same as SPANISH_LOCALE but with DD/MM/YYYY HH:mm format for time picker usage.
|
|
1854
|
+
*
|
|
1855
|
+
* @example
|
|
1856
|
+
* ```typescript
|
|
1857
|
+
* <ngx-datex [locale]="SPANISH_LOCALE_WITH_TIME" [timePicker]="true"></ngx-datex>
|
|
1858
|
+
* ```
|
|
1859
|
+
*/
|
|
1860
|
+
declare const SPANISH_LOCALE_WITH_TIME: NgxDatexLocale;
|
|
1861
|
+
/**
|
|
1862
|
+
* Spanish locale with time picker support (12-hour format).
|
|
1863
|
+
*
|
|
1864
|
+
* Same as SPANISH_LOCALE but with DD/MM/YYYY hh:mm A format for 12-hour time picker.
|
|
1865
|
+
*
|
|
1866
|
+
* @example
|
|
1867
|
+
* ```typescript
|
|
1868
|
+
* <ngx-datex [locale]="SPANISH_LOCALE_WITH_TIME_12H" [timePicker]="true" [timePicker24Hour]="false"></ngx-datex>
|
|
1869
|
+
* ```
|
|
1870
|
+
*/
|
|
1871
|
+
declare const SPANISH_LOCALE_WITH_TIME_12H: NgxDatexLocale;
|
|
1872
|
+
/**
|
|
1873
|
+
* US English locale configuration.
|
|
1874
|
+
*
|
|
1875
|
+
* Provides English language support with MM/DD/YYYY format,
|
|
1876
|
+
* English day/month names, and Sunday as the first day of the week.
|
|
1877
|
+
*
|
|
1878
|
+
* @example
|
|
1879
|
+
* ```typescript
|
|
1880
|
+
* <ngx-datex [locale]="US_ENGLISH_LOCALE"></ngx-datex>
|
|
1881
|
+
* ```
|
|
1882
|
+
*/
|
|
1883
|
+
declare const US_ENGLISH_LOCALE: NgxDatexLocale;
|
|
1884
|
+
/**
|
|
1885
|
+
* US English locale with time picker support (12-hour format).
|
|
1886
|
+
*
|
|
1887
|
+
* Same as US_ENGLISH_LOCALE but with MM/DD/YYYY hh:mm A format for time picker usage.
|
|
1888
|
+
*
|
|
1889
|
+
* @example
|
|
1890
|
+
* ```typescript
|
|
1891
|
+
* <ngx-datex [locale]="US_ENGLISH_LOCALE_WITH_TIME" [timePicker]="true" [timePicker24Hour]="false"></ngx-datex>
|
|
1892
|
+
* ```
|
|
1893
|
+
*/
|
|
1894
|
+
declare const US_ENGLISH_LOCALE_WITH_TIME: NgxDatexLocale;
|
|
1895
|
+
/**
|
|
1896
|
+
* ISO format locale configuration.
|
|
1897
|
+
*
|
|
1898
|
+
* Provides YYYY-MM-DD format commonly used in APIs and databases,
|
|
1899
|
+
* with English labels and Monday as the first day of the week.
|
|
1900
|
+
*
|
|
1901
|
+
* @example
|
|
1902
|
+
* ```typescript
|
|
1903
|
+
* <ngx-datex [locale]="ISO_LOCALE"></ngx-datex>
|
|
1904
|
+
* ```
|
|
1905
|
+
*/
|
|
1906
|
+
declare const ISO_LOCALE: NgxDatexLocale;
|
|
1907
|
+
/**
|
|
1908
|
+
* ISO format locale with time picker support (24-hour format).
|
|
1909
|
+
*
|
|
1910
|
+
* Same as ISO_LOCALE but with YYYY-MM-DD HH:mm format for time picker usage.
|
|
1911
|
+
*
|
|
1912
|
+
* @example
|
|
1913
|
+
* ```typescript
|
|
1914
|
+
* <ngx-datex [locale]="ISO_LOCALE_WITH_TIME" [timePicker]="true"></ngx-datex>
|
|
1915
|
+
* ```
|
|
1916
|
+
*/
|
|
1917
|
+
declare const ISO_LOCALE_WITH_TIME: NgxDatexLocale;
|
|
1531
1918
|
/**
|
|
1532
1919
|
* Default Material Design light theme.
|
|
1533
1920
|
*
|
|
@@ -1576,8 +1963,8 @@ declare const DEFAULT_RANGES: Record<string, [Date, Date]>;
|
|
|
1576
1963
|
*
|
|
1577
1964
|
* // Update configuration
|
|
1578
1965
|
* this.datexService.updateConfig({
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1966
|
+
* firstDayOfWeek: 1,
|
|
1967
|
+
* businessDaysOnly: true
|
|
1581
1968
|
* });
|
|
1582
1969
|
*
|
|
1583
1970
|
* // Format a date range
|
|
@@ -1595,9 +1982,9 @@ declare class NgxDatexService {
|
|
|
1595
1982
|
* @example
|
|
1596
1983
|
* ```typescript
|
|
1597
1984
|
* this.datexService.updateConfig({
|
|
1598
|
-
* dateFormat: 'YYYY-MM-DD',
|
|
1599
1985
|
* firstDayOfWeek: 0, // Sunday
|
|
1600
|
-
* businessDaysOnly: true
|
|
1986
|
+
* businessDaysOnly: true,
|
|
1987
|
+
* showWeekNumbers: true
|
|
1601
1988
|
* });
|
|
1602
1989
|
* ```
|
|
1603
1990
|
*/
|
|
@@ -2000,10 +2387,10 @@ declare class NgxDatexTimePickerService {
|
|
|
2000
2387
|
|
|
2001
2388
|
declare class NgxDatexCalendarService {
|
|
2002
2389
|
updateMonthsInView(startDate: Date, endDate: Date | null, currentLeftMonth: Date, currentRightMonth: Date, singleDatePicker: boolean, linkedCalendars: boolean, maxDate: Date | null, onLeftMonthChange: (month: Date) => void, onRightMonthChange: (month: Date) => void): void;
|
|
2003
|
-
setStartDate(startDate: Date, minDate: Date | null, maxDate: Date | null, timePicker: boolean, timePickerIncrement: number): Date;
|
|
2390
|
+
setStartDate(startDate: Date, minDate: Date | null, maxDate: Date | null, timePicker: boolean, timePickerIncrement: number, currentStartDate?: Date | null): Date;
|
|
2004
2391
|
setEndDate(endDate: Date, startDate: Date, maxDate: Date | null, maxSpan: {
|
|
2005
2392
|
[key: string]: number;
|
|
2006
|
-
} | null, timePicker: boolean, timePickerIncrement: number): Date;
|
|
2393
|
+
} | null, timePicker: boolean, timePickerIncrement: number, currentEndDate?: Date | null): Date;
|
|
2007
2394
|
private getMaxSpanDays;
|
|
2008
2395
|
isDateDisabled(date: Date, minDate: Date | null, maxDate: Date | null, maxSpan: {
|
|
2009
2396
|
[key: string]: number;
|
|
@@ -2148,14 +2535,47 @@ declare function isSameMonth(date1: Date, date2: Date): boolean;
|
|
|
2148
2535
|
* ```
|
|
2149
2536
|
*/
|
|
2150
2537
|
declare function isSameYear(date1: Date, date2: Date): boolean;
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2538
|
+
/**
|
|
2539
|
+
* Formats a date using the specified format string and locale.
|
|
2540
|
+
* Follows vanilla-daterangepicker logic by always using locale.format.
|
|
2541
|
+
*
|
|
2542
|
+
* @param date - The date to format
|
|
2543
|
+
* @param formatStr - Format string (e.g., 'DD/MM/YYYY', 'MM/DD/YYYY HH:mm')
|
|
2544
|
+
* @param locale - Optional locale string (e.g., 'es-ES', 'en-US')
|
|
2545
|
+
* @returns Formatted date string
|
|
2546
|
+
*
|
|
2547
|
+
* @example
|
|
2548
|
+
* ```typescript
|
|
2549
|
+
* const date = new Date('2024-01-15 14:30:00');
|
|
2550
|
+
* formatDateValue(date, 'DD/MM/YYYY'); // '15/01/2024'
|
|
2551
|
+
* formatDateValue(date, 'MM/DD/YYYY hh:mm A'); // '01/15/2024 02:30 PM'
|
|
2552
|
+
* formatDateValue(date, 'DD/MM/YYYY HH:mm', 'es-ES'); // '15/01/2024 14:30'
|
|
2553
|
+
* ```
|
|
2554
|
+
*/
|
|
2555
|
+
declare function formatDateValue(date: Date, formatStr: string, locale?: string): string;
|
|
2556
|
+
/**
|
|
2557
|
+
* Parses a date string using the specified format string and locale.
|
|
2558
|
+
* Follows vanilla-daterangepicker logic by always using locale.format.
|
|
2559
|
+
*
|
|
2560
|
+
* @param dateStr - The date string to parse
|
|
2561
|
+
* @param formatStr - Format string (e.g., 'DD/MM/YYYY', 'MM/DD/YYYY HH:mm')
|
|
2562
|
+
* @param locale - Optional locale string (e.g., 'es-ES', 'en-US')
|
|
2563
|
+
* @returns Parsed Date object
|
|
2564
|
+
*
|
|
2565
|
+
* @example
|
|
2566
|
+
* ```typescript
|
|
2567
|
+
* const date1 = parseDateValue('15/01/2024', 'DD/MM/YYYY'); // January 15, 2024
|
|
2568
|
+
* const date2 = parseDateValue('01/15/2024 02:30 PM', 'MM/DD/YYYY hh:mm A'); // January 15, 2024 14:30
|
|
2569
|
+
* const date3 = parseDateValue('15/01/2024 14:30', 'DD/MM/YYYY HH:mm', 'es-ES'); // January 15, 2024 14:30
|
|
2570
|
+
* ```
|
|
2571
|
+
*/
|
|
2572
|
+
declare function parseDateValue(dateStr: string, formatStr: string, locale?: string): Date;
|
|
2573
|
+
declare function isSameDate(date1: Date, date2: Date, unit?: 'day' | 'month' | 'year' | 'minute' | 'second'): boolean;
|
|
2154
2574
|
declare function isValidDate(date: Date | null | undefined): date is Date;
|
|
2155
2575
|
declare function isBeforeDate(date1: Date, date2: Date): boolean;
|
|
2156
2576
|
declare function getStartOfMonth(date: Date): Date;
|
|
2157
2577
|
declare function getStartOfWeek(date: Date, firstDay?: number): Date;
|
|
2158
2578
|
declare function isMobileDevice(): boolean;
|
|
2159
2579
|
|
|
2160
|
-
export { DEFAULT_RANGES, MATERIAL_LIGHT_THEME, NgxDatex, NgxDatexCalendarService, NgxDatexOverlayService, NgxDatexService, NgxDatexTimePickerService, SPANISH_LOCALE, addDays, addMonths, endOfDay, formatDateValue, getStartOfMonth, getStartOfWeek, isBeforeDate, isMobileDevice, isSameDate, isSameDay, isSameMonth, isSameYear, isValidDate, parseDateValue, startOfDay, startOfMonth, startOfWeek };
|
|
2580
|
+
export { DEFAULT_RANGES, ISO_LOCALE, ISO_LOCALE_WITH_TIME, MATERIAL_LIGHT_THEME, NgxDatex, NgxDatexCalendarService, NgxDatexOverlayService, NgxDatexService, NgxDatexTimePickerService, SPANISH_LOCALE, SPANISH_LOCALE_WITH_TIME, SPANISH_LOCALE_WITH_TIME_12H, US_ENGLISH_LOCALE, US_ENGLISH_LOCALE_WITH_TIME, addDays, addMonths, endOfDay, formatDateValue, getStartOfMonth, getStartOfWeek, isBeforeDate, isMobileDevice, isSameDate, isSameDay, isSameMonth, isSameYear, isValidDate, parseDateValue, startOfDay, startOfMonth, startOfWeek };
|
|
2161
2581
|
export type { NgxDatexConfig, NgxDatexInputs, NgxDatexLocale, NgxDatexOutputs, NgxDatexOverlayPosition, NgxDatexRange, NgxDatexTheme, NgxDatexTimeValue, NgxDatexValidationResult, NgxDatexValue };
|