@aurodesignsystem/auro-formkit 2.0.0-beta.46 → 2.0.0-beta.48
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/CHANGELOG.md +45 -0
- package/components/bibtemplate/dist/index.js +3 -3
- package/components/bibtemplate/dist/registered.js +3 -3
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.min.js +9 -12
- package/components/checkbox/demo/index.min.js +9 -12
- package/components/checkbox/dist/index.js +9 -12
- package/components/checkbox/dist/registered.js +9 -12
- package/components/combobox/README.md +4 -4
- package/components/combobox/demo/api.md +2 -2
- package/components/combobox/demo/api.min.js +3858 -1703
- package/components/combobox/demo/index.md +2 -2
- package/components/combobox/demo/index.min.js +3858 -1703
- package/components/combobox/dist/auro-combobox.d.ts +9 -0
- package/components/combobox/dist/index.js +3829 -1674
- package/components/combobox/dist/registered.js +3829 -1674
- package/components/counter/README.md +1 -1
- package/components/counter/demo/api.min.js +52 -29
- package/components/counter/demo/index.min.js +52 -29
- package/components/counter/dist/auro-counter-group.d.ts +11 -0
- package/components/counter/dist/index.js +52 -29
- package/components/counter/dist/registered.js +52 -29
- package/components/datepicker/README.md +6 -4
- package/components/datepicker/demo/api.js +2 -2
- package/components/datepicker/demo/api.md +134 -48
- package/components/datepicker/demo/api.min.js +5175 -2043
- package/components/datepicker/demo/index.md +6 -0
- package/components/datepicker/demo/index.min.js +5161 -2028
- package/components/datepicker/dist/auro-calendar-month.d.ts +15 -0
- package/components/datepicker/dist/auro-calendar.d.ts +24 -0
- package/components/datepicker/dist/auro-datepicker.d.ts +31 -11
- package/components/datepicker/dist/bibtemplateVersion.d.ts +2 -0
- package/components/datepicker/dist/index.js +5161 -2028
- package/components/datepicker/dist/registered.js +5161 -2028
- package/components/datepicker/dist/utilities.d.ts +25 -0
- package/components/datepicker/dist/utilitiesCalendar.d.ts +2 -1
- package/components/dropdown/README.md +1 -1
- package/components/form/README.md +1 -1
- package/components/input/README.md +1 -1
- package/components/input/demo/api.md +91 -89
- package/components/input/demo/api.min.js +3827 -1688
- package/components/input/demo/index.md +2 -2
- package/components/input/demo/index.min.js +3827 -1688
- package/components/input/dist/auro-input.d.ts +0 -1
- package/components/input/dist/base-input.d.ts +46 -12
- package/components/input/dist/index.js +3827 -1688
- package/components/input/dist/registered.js +3827 -1688
- package/components/input/dist/utilities.d.ts +25 -0
- package/components/menu/README.md +1 -1
- package/components/radio/README.md +1 -1
- package/components/radio/demo/api.min.js +9 -12
- package/components/radio/demo/index.min.js +9 -12
- package/components/radio/dist/index.js +9 -12
- package/components/radio/dist/registered.js +9 -12
- package/components/select/README.md +3 -3
- package/components/select/demo/api.min.js +9 -12
- package/components/select/demo/index.min.js +9 -12
- package/components/select/dist/index.js +9 -12
- package/components/select/dist/registered.js +9 -12
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class AuroInputUtilities {
|
|
2
|
+
/**
|
|
3
|
+
* Configures the mask to be used on the input element based on format and/or type.
|
|
4
|
+
* IMask tool documentation: https://imask.js.org/.
|
|
5
|
+
* @private
|
|
6
|
+
* @param {string} type - The input type.
|
|
7
|
+
* @param {string} format - The format of the mask to apply.
|
|
8
|
+
* @returns {void}
|
|
9
|
+
*/
|
|
10
|
+
private getMaskOptions;
|
|
11
|
+
/**
|
|
12
|
+
* @private
|
|
13
|
+
* @param {string} dateStr - Date string to format.
|
|
14
|
+
* @param {string} format - Date format to use.
|
|
15
|
+
* @returns {void}
|
|
16
|
+
*/
|
|
17
|
+
private toNorthAmericanFormat;
|
|
18
|
+
/**
|
|
19
|
+
* @private
|
|
20
|
+
* @param {string} dateStr - Date string to parse.
|
|
21
|
+
* @param {string} format - Date format to parse.
|
|
22
|
+
* @returns {void}
|
|
23
|
+
*/
|
|
24
|
+
private parseDate;
|
|
25
|
+
}
|
|
@@ -100,7 +100,7 @@ In cases where the project is not able to process JS assets, there are pre-proce
|
|
|
100
100
|
<!-- The below content is automatically added from ../../docs/templates/componentBundleUseModBrowsers.md -->
|
|
101
101
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@4.13.0/dist/tokens/CSSCustomProperties.css" />
|
|
102
102
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@5.1.2/dist/bundled/essentials.css" />
|
|
103
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-menu@2.0.0-beta.
|
|
103
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-menu@2.0.0-beta.47/dist/auro-menu__bundled.js" type="module"></script>
|
|
104
104
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
105
105
|
|
|
106
106
|
## auro-menu use cases
|
|
@@ -90,7 +90,7 @@ In cases where the project is not able to process JS assets, there are pre-proce
|
|
|
90
90
|
<!-- The below content is automatically added from ../../docs/templates/componentBundleUseModBrowsers.md -->
|
|
91
91
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@4.13.0/dist/tokens/CSSCustomProperties.css" />
|
|
92
92
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@5.1.2/dist/bundled/essentials.css" />
|
|
93
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-radio@2.0.0-beta.
|
|
93
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-radio@2.0.0-beta.47/dist/auro-radio__bundled.js" type="module"></script>
|
|
94
94
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
95
95
|
|
|
96
96
|
## auro-radio use cases
|
|
@@ -547,20 +547,17 @@ class AuroFormValidation {
|
|
|
547
547
|
elem.validity = 'rangeUnderflow';
|
|
548
548
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
549
549
|
}
|
|
550
|
-
} else if (elem.type === '
|
|
551
|
-
|
|
552
|
-
elem.type === 'month-fullYear' ||
|
|
553
|
-
elem.type === 'year-month-day'
|
|
554
|
-
) {
|
|
555
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
550
|
+
} else if (elem.type === 'date') {
|
|
551
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
556
552
|
elem.validity = 'tooShort';
|
|
557
553
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
558
|
-
} else {
|
|
559
|
-
const
|
|
554
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
555
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
556
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
560
557
|
|
|
561
558
|
// validate max
|
|
562
|
-
if (elem.max
|
|
563
|
-
const maxDate = new Date(elem.max);
|
|
559
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
560
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
564
561
|
|
|
565
562
|
if (valueDate > maxDate) {
|
|
566
563
|
elem.validity = 'rangeOverflow';
|
|
@@ -569,8 +566,8 @@ class AuroFormValidation {
|
|
|
569
566
|
}
|
|
570
567
|
|
|
571
568
|
// validate min
|
|
572
|
-
if (elem.min) {
|
|
573
|
-
const minDate = new Date(elem.min);
|
|
569
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
570
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
574
571
|
|
|
575
572
|
if (valueDate < minDate) {
|
|
576
573
|
elem.validity = 'rangeUnderflow';
|
|
@@ -522,20 +522,17 @@ class AuroFormValidation {
|
|
|
522
522
|
elem.validity = 'rangeUnderflow';
|
|
523
523
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
524
524
|
}
|
|
525
|
-
} else if (elem.type === '
|
|
526
|
-
|
|
527
|
-
elem.type === 'month-fullYear' ||
|
|
528
|
-
elem.type === 'year-month-day'
|
|
529
|
-
) {
|
|
530
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
525
|
+
} else if (elem.type === 'date') {
|
|
526
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
531
527
|
elem.validity = 'tooShort';
|
|
532
528
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
533
|
-
} else {
|
|
534
|
-
const
|
|
529
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
530
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
531
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
535
532
|
|
|
536
533
|
// validate max
|
|
537
|
-
if (elem.max
|
|
538
|
-
const maxDate = new Date(elem.max);
|
|
534
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
535
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
539
536
|
|
|
540
537
|
if (valueDate > maxDate) {
|
|
541
538
|
elem.validity = 'rangeOverflow';
|
|
@@ -544,8 +541,8 @@ class AuroFormValidation {
|
|
|
544
541
|
}
|
|
545
542
|
|
|
546
543
|
// validate min
|
|
547
|
-
if (elem.min) {
|
|
548
|
-
const minDate = new Date(elem.min);
|
|
544
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
545
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
549
546
|
|
|
550
547
|
if (valueDate < minDate) {
|
|
551
548
|
elem.validity = 'rangeUnderflow';
|
|
@@ -522,20 +522,17 @@ class AuroFormValidation {
|
|
|
522
522
|
elem.validity = 'rangeUnderflow';
|
|
523
523
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
524
524
|
}
|
|
525
|
-
} else if (elem.type === '
|
|
526
|
-
|
|
527
|
-
elem.type === 'month-fullYear' ||
|
|
528
|
-
elem.type === 'year-month-day'
|
|
529
|
-
) {
|
|
530
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
525
|
+
} else if (elem.type === 'date') {
|
|
526
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
531
527
|
elem.validity = 'tooShort';
|
|
532
528
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
533
|
-
} else {
|
|
534
|
-
const
|
|
529
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
530
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
531
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
535
532
|
|
|
536
533
|
// validate max
|
|
537
|
-
if (elem.max
|
|
538
|
-
const maxDate = new Date(elem.max);
|
|
534
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
535
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
539
536
|
|
|
540
537
|
if (valueDate > maxDate) {
|
|
541
538
|
elem.validity = 'rangeOverflow';
|
|
@@ -544,8 +541,8 @@ class AuroFormValidation {
|
|
|
544
541
|
}
|
|
545
542
|
|
|
546
543
|
// validate min
|
|
547
|
-
if (elem.min) {
|
|
548
|
-
const minDate = new Date(elem.min);
|
|
544
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
545
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
549
546
|
|
|
550
547
|
if (valueDate < minDate) {
|
|
551
548
|
elem.validity = 'rangeUnderflow';
|
|
@@ -522,20 +522,17 @@ class AuroFormValidation {
|
|
|
522
522
|
elem.validity = 'rangeUnderflow';
|
|
523
523
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
524
524
|
}
|
|
525
|
-
} else if (elem.type === '
|
|
526
|
-
|
|
527
|
-
elem.type === 'month-fullYear' ||
|
|
528
|
-
elem.type === 'year-month-day'
|
|
529
|
-
) {
|
|
530
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
525
|
+
} else if (elem.type === 'date') {
|
|
526
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
531
527
|
elem.validity = 'tooShort';
|
|
532
528
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
533
|
-
} else {
|
|
534
|
-
const
|
|
529
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
530
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
531
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
535
532
|
|
|
536
533
|
// validate max
|
|
537
|
-
if (elem.max
|
|
538
|
-
const maxDate = new Date(elem.max);
|
|
534
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
535
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
539
536
|
|
|
540
537
|
if (valueDate > maxDate) {
|
|
541
538
|
elem.validity = 'rangeOverflow';
|
|
@@ -544,8 +541,8 @@ class AuroFormValidation {
|
|
|
544
541
|
}
|
|
545
542
|
|
|
546
543
|
// validate min
|
|
547
|
-
if (elem.min) {
|
|
548
|
-
const minDate = new Date(elem.min);
|
|
544
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
545
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
549
546
|
|
|
550
547
|
if (valueDate < minDate) {
|
|
551
548
|
elem.validity = 'rangeUnderflow';
|
|
@@ -99,9 +99,9 @@ In cases where the project is not able to process JS assets, there are pre-proce
|
|
|
99
99
|
<!-- The below content is automatically added from ../../docs/templates/componentBundleUseModBrowsers.md -->
|
|
100
100
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@4.13.0/dist/tokens/CSSCustomProperties.css" />
|
|
101
101
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@5.1.2/dist/bundled/essentials.css" />
|
|
102
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-dropdown@2.0.0-beta.
|
|
103
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-menu@2.0.0-beta.
|
|
104
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-select@2.0.0-beta.
|
|
102
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-dropdown@2.0.0-beta.47/dist/auro-dropdown__bundled.js" type="module"></script>
|
|
103
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-menu@2.0.0-beta.47/dist/auro-menu__bundled.js" type="module"></script>
|
|
104
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-select@2.0.0-beta.47/dist/auro-select__bundled.js" type="module"></script>
|
|
105
105
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
106
106
|
|
|
107
107
|
## auro-select use cases
|
|
@@ -366,20 +366,17 @@ class AuroFormValidation {
|
|
|
366
366
|
elem.validity = 'rangeUnderflow';
|
|
367
367
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
368
368
|
}
|
|
369
|
-
} else if (elem.type === '
|
|
370
|
-
|
|
371
|
-
elem.type === 'month-fullYear' ||
|
|
372
|
-
elem.type === 'year-month-day'
|
|
373
|
-
) {
|
|
374
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
369
|
+
} else if (elem.type === 'date') {
|
|
370
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
375
371
|
elem.validity = 'tooShort';
|
|
376
372
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
377
|
-
} else {
|
|
378
|
-
const
|
|
373
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
374
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
375
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
379
376
|
|
|
380
377
|
// validate max
|
|
381
|
-
if (elem.max
|
|
382
|
-
const maxDate = new Date(elem.max);
|
|
378
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
379
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
383
380
|
|
|
384
381
|
if (valueDate > maxDate) {
|
|
385
382
|
elem.validity = 'rangeOverflow';
|
|
@@ -388,8 +385,8 @@ class AuroFormValidation {
|
|
|
388
385
|
}
|
|
389
386
|
|
|
390
387
|
// validate min
|
|
391
|
-
if (elem.min) {
|
|
392
|
-
const minDate = new Date(elem.min);
|
|
388
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
389
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
393
390
|
|
|
394
391
|
if (valueDate < minDate) {
|
|
395
392
|
elem.validity = 'rangeUnderflow';
|
|
@@ -262,20 +262,17 @@ class AuroFormValidation {
|
|
|
262
262
|
elem.validity = 'rangeUnderflow';
|
|
263
263
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
264
264
|
}
|
|
265
|
-
} else if (elem.type === '
|
|
266
|
-
|
|
267
|
-
elem.type === 'month-fullYear' ||
|
|
268
|
-
elem.type === 'year-month-day'
|
|
269
|
-
) {
|
|
270
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
265
|
+
} else if (elem.type === 'date') {
|
|
266
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
271
267
|
elem.validity = 'tooShort';
|
|
272
268
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
273
|
-
} else {
|
|
274
|
-
const
|
|
269
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
270
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
271
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
275
272
|
|
|
276
273
|
// validate max
|
|
277
|
-
if (elem.max
|
|
278
|
-
const maxDate = new Date(elem.max);
|
|
274
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
275
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
279
276
|
|
|
280
277
|
if (valueDate > maxDate) {
|
|
281
278
|
elem.validity = 'rangeOverflow';
|
|
@@ -284,8 +281,8 @@ class AuroFormValidation {
|
|
|
284
281
|
}
|
|
285
282
|
|
|
286
283
|
// validate min
|
|
287
|
-
if (elem.min) {
|
|
288
|
-
const minDate = new Date(elem.min);
|
|
284
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
285
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
289
286
|
|
|
290
287
|
if (valueDate < minDate) {
|
|
291
288
|
elem.validity = 'rangeUnderflow';
|
|
@@ -262,20 +262,17 @@ class AuroFormValidation {
|
|
|
262
262
|
elem.validity = 'rangeUnderflow';
|
|
263
263
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
264
264
|
}
|
|
265
|
-
} else if (elem.type === '
|
|
266
|
-
|
|
267
|
-
elem.type === 'month-fullYear' ||
|
|
268
|
-
elem.type === 'year-month-day'
|
|
269
|
-
) {
|
|
270
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
265
|
+
} else if (elem.type === 'date') {
|
|
266
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
271
267
|
elem.validity = 'tooShort';
|
|
272
268
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
273
|
-
} else {
|
|
274
|
-
const
|
|
269
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
270
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
271
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
275
272
|
|
|
276
273
|
// validate max
|
|
277
|
-
if (elem.max
|
|
278
|
-
const maxDate = new Date(elem.max);
|
|
274
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
275
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
279
276
|
|
|
280
277
|
if (valueDate > maxDate) {
|
|
281
278
|
elem.validity = 'rangeOverflow';
|
|
@@ -284,8 +281,8 @@ class AuroFormValidation {
|
|
|
284
281
|
}
|
|
285
282
|
|
|
286
283
|
// validate min
|
|
287
|
-
if (elem.min) {
|
|
288
|
-
const minDate = new Date(elem.min);
|
|
284
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
285
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
289
286
|
|
|
290
287
|
if (valueDate < minDate) {
|
|
291
288
|
elem.validity = 'rangeUnderflow';
|
|
@@ -262,20 +262,17 @@ class AuroFormValidation {
|
|
|
262
262
|
elem.validity = 'rangeUnderflow';
|
|
263
263
|
elem.errorMessage = elem.setCustomValidityRangeUnderflow || elem.setCustomValidity || '';
|
|
264
264
|
}
|
|
265
|
-
} else if (elem.type === '
|
|
266
|
-
|
|
267
|
-
elem.type === 'month-fullYear' ||
|
|
268
|
-
elem.type === 'year-month-day'
|
|
269
|
-
) {
|
|
270
|
-
if (elem.value?.length > 0 && elem.value.length < elem.dateStrLength) {
|
|
265
|
+
} else if (elem.type === 'date') {
|
|
266
|
+
if (elem.value?.length > 0 && elem.value?.length < elem.lengthForType) {
|
|
271
267
|
elem.validity = 'tooShort';
|
|
272
268
|
elem.errorMessage = elem.setCustomValidityForType || elem.setCustomValidity || '';
|
|
273
|
-
} else {
|
|
274
|
-
const
|
|
269
|
+
} else if (elem.value?.length === elem.lengthForType && elem.util.toNorthAmericanFormat(elem.value, elem.format)) {
|
|
270
|
+
const formattedValue = elem.util.toNorthAmericanFormat(elem.value, elem.format);
|
|
271
|
+
const valueDate = new Date(formattedValue.dateForComparison);
|
|
275
272
|
|
|
276
273
|
// validate max
|
|
277
|
-
if (elem.max
|
|
278
|
-
const maxDate = new Date(elem.max);
|
|
274
|
+
if (elem.max?.length === elem.lengthForType) {
|
|
275
|
+
const maxDate = new Date(elem.util.toNorthAmericanFormat(elem.max, elem.format).dateForComparison);
|
|
279
276
|
|
|
280
277
|
if (valueDate > maxDate) {
|
|
281
278
|
elem.validity = 'rangeOverflow';
|
|
@@ -284,8 +281,8 @@ class AuroFormValidation {
|
|
|
284
281
|
}
|
|
285
282
|
|
|
286
283
|
// validate min
|
|
287
|
-
if (elem.min) {
|
|
288
|
-
const minDate = new Date(elem.min);
|
|
284
|
+
if (elem.min?.length === elem.lengthForType) {
|
|
285
|
+
const minDate = new Date(elem.util.toNorthAmericanFormat(elem.min, elem.format).dateForComparison);
|
|
289
286
|
|
|
290
287
|
if (valueDate < minDate) {
|
|
291
288
|
elem.validity = 'rangeUnderflow';
|
package/package.json
CHANGED