@aurodesignsystem-dev/auro-formkit 0.0.0-pr1483.0 → 0.0.0-pr1483.2
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/components/checkbox/demo/customize.min.js +2 -233
- package/components/checkbox/demo/getting-started.min.js +2 -233
- package/components/checkbox/demo/index.min.js +2 -233
- package/components/checkbox/dist/index.js +2 -233
- package/components/checkbox/dist/registered.js +2 -233
- package/components/combobox/demo/customize.min.js +5 -236
- package/components/combobox/demo/getting-started.min.js +5 -236
- package/components/combobox/demo/index.min.js +5 -236
- package/components/combobox/dist/index.js +5 -236
- package/components/combobox/dist/registered.js +5 -236
- package/components/counter/demo/customize.min.js +3 -234
- package/components/counter/demo/index.min.js +3 -234
- package/components/counter/dist/index.js +2 -233
- package/components/counter/dist/registered.js +2 -233
- package/components/datepicker/demo/index.min.js +8 -7
- package/components/datepicker/dist/index.js +8 -7
- package/components/datepicker/dist/registered.js +8 -7
- package/components/dropdown/demo/customize.min.js +1 -1
- package/components/dropdown/demo/getting-started.min.js +1 -1
- package/components/dropdown/demo/index.min.js +1 -1
- package/components/dropdown/dist/index.js +1 -1
- package/components/dropdown/dist/registered.js +1 -1
- package/components/form/demo/customize.min.js +170 -1324
- package/components/form/demo/getting-started.min.js +170 -1324
- package/components/form/demo/index.min.js +170 -1324
- package/components/form/demo/registerDemoDeps.min.js +170 -1324
- package/components/input/demo/customize.min.js +2 -2
- package/components/input/demo/getting-started.min.js +2 -2
- package/components/input/demo/index.min.js +2 -2
- package/components/input/dist/index.js +2 -2
- package/components/input/dist/registered.js +2 -2
- package/components/radio/demo/index.min.js +2 -233
- package/components/radio/dist/index.js +2 -233
- package/components/radio/dist/registered.js +2 -233
- package/components/select/demo/customize.min.js +3 -234
- package/components/select/demo/getting-started.min.js +3 -234
- package/components/select/demo/index.min.js +3 -234
- package/components/select/dist/index.js +3 -234
- package/components/select/dist/registered.js +3 -234
- package/custom-elements.json +1444 -1444
- package/package.json +1 -1
|
@@ -492,237 +492,6 @@ class AuroCheckbox extends LitElement {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
/**
|
|
496
|
-
* @description Splits a date string into its parts according to the provided format. Does NOT validate that the result is a real calendar date — use `parseDate` when validation is required.
|
|
497
|
-
* @param {string} dateStr - Date string to parse.
|
|
498
|
-
* @param {string} format - Date format to parse.
|
|
499
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
500
|
-
*/
|
|
501
|
-
function getDateParts(dateStr, format) {
|
|
502
|
-
if (!dateStr) {
|
|
503
|
-
return undefined;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
const formatSeparatorMatch = format.match(/[/.-]/);
|
|
507
|
-
let valueParts;
|
|
508
|
-
let formatParts;
|
|
509
|
-
|
|
510
|
-
if (formatSeparatorMatch) {
|
|
511
|
-
const separator = formatSeparatorMatch[0];
|
|
512
|
-
valueParts = dateStr.split(separator);
|
|
513
|
-
formatParts = format.split(separator);
|
|
514
|
-
} else {
|
|
515
|
-
if (dateStr.match(/[/.-]/)) {
|
|
516
|
-
throw new Error(
|
|
517
|
-
"AuroDatepickerUtilities | parseDate: Date string has no separators",
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
if (dateStr.length !== format.length) {
|
|
522
|
-
throw new Error(
|
|
523
|
-
"AuroDatepickerUtilities | parseDate: Date string and format length do not match",
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
valueParts = [dateStr];
|
|
528
|
-
formatParts = [format];
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (valueParts.length !== formatParts.length) {
|
|
532
|
-
throw new Error(
|
|
533
|
-
`AuroDatepickerUtilities | parseDate: Date string and format do not match : ${dateStr} vs ${format}`,
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
const result = formatParts.reduce((acc, part, index) => {
|
|
538
|
-
const value = valueParts[index];
|
|
539
|
-
|
|
540
|
-
if (/m/iu.test(part) && part.length === value.length) {
|
|
541
|
-
acc.month = value;
|
|
542
|
-
} else if (/d/iu.test(part) && part.length === value.length) {
|
|
543
|
-
acc.day = value;
|
|
544
|
-
} else if (/y/iu.test(part) && part.length === value.length) {
|
|
545
|
-
acc.year = value;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
return acc;
|
|
549
|
-
}, {});
|
|
550
|
-
|
|
551
|
-
if (!result.month && !result.day && !result.year) {
|
|
552
|
-
throw new Error(
|
|
553
|
-
"AuroDatepickerUtilities | parseDate: Unable to parse date string",
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
return result;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
function isCalendarDate(year, month, day) {
|
|
561
|
-
let yearNumber = Number(year);
|
|
562
|
-
const monthNumber = Number(month);
|
|
563
|
-
const dayNumber = Number(day);
|
|
564
|
-
|
|
565
|
-
if (
|
|
566
|
-
!Number.isInteger(yearNumber) ||
|
|
567
|
-
!Number.isInteger(monthNumber) ||
|
|
568
|
-
!Number.isInteger(dayNumber)
|
|
569
|
-
) {
|
|
570
|
-
return false;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// Handle 2-digit years by converting them to 4-digit years based on a cutoff. This allows for parsing of 2-digit year formats while still validating the resulting date.
|
|
574
|
-
if (yearNumber < 100 && yearNumber >= 50) {
|
|
575
|
-
yearNumber += 1900;
|
|
576
|
-
} else if (yearNumber < 50) {
|
|
577
|
-
yearNumber += 2000;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
const stringified = `${String(yearNumber).padStart(4, "0")}-${String(monthNumber).padStart(2, "0")}-${String(dayNumber).padStart(2, "0")}`;
|
|
581
|
-
const date = new Date(stringified.replace(/[.-]/g, "/"));
|
|
582
|
-
|
|
583
|
-
return (
|
|
584
|
-
!Number.isNaN(date.getTime()) && toISOFormatString(date) === stringified
|
|
585
|
-
);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
/**
|
|
589
|
-
* @description Parses a date string into its components and validates that the result is a real calendar date. Use `getDateParts` instead when raw splitting without validation is needed (e.g. for in-progress input).
|
|
590
|
-
*
|
|
591
|
-
* Partial formats are supported: components absent from `format` default to `year → "0"`,
|
|
592
|
-
* `month → "01"`, `day → "01"` for calendar validation only. The returned object contains
|
|
593
|
-
* only the fields actually present in the format string — missing fields are never injected.
|
|
594
|
-
* @param {string} dateStr - Date string to parse.
|
|
595
|
-
* @param {string} format - Date format to parse.
|
|
596
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
597
|
-
* @throws {Error} Throws when the parsed result does not represent a valid calendar date.
|
|
598
|
-
*/
|
|
599
|
-
function parseDate(dateStr, format = "mm/dd/yyyy") {
|
|
600
|
-
if (!dateStr || !format) {
|
|
601
|
-
return undefined;
|
|
602
|
-
}
|
|
603
|
-
const result = getDateParts(dateStr.trim(), format);
|
|
604
|
-
|
|
605
|
-
if (!result) {
|
|
606
|
-
return undefined;
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
const lowerFormat = format.toLowerCase();
|
|
610
|
-
const year = lowerFormat.includes("yy") ? result.year : "0";
|
|
611
|
-
const month = lowerFormat.includes("mm") ? result.month : "01";
|
|
612
|
-
const day = lowerFormat.includes("dd") ? result.day : "01";
|
|
613
|
-
|
|
614
|
-
if (isCalendarDate(year, month, day)) {
|
|
615
|
-
return result;
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
throw new Error(
|
|
619
|
-
`AuroDatepickerUtilities | parseDate: Date string is not a valid date ${JSON.stringify(result)} with format ${format}`,
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Convert a date object to string format.
|
|
625
|
-
* @param {Object} date - Date to convert to string.
|
|
626
|
-
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
627
|
-
* @returns {String} Returns the date as a string.
|
|
628
|
-
*/
|
|
629
|
-
function getDateAsString(date, locale = undefined) {
|
|
630
|
-
return date.toLocaleDateString(locale, {
|
|
631
|
-
year: "numeric",
|
|
632
|
-
month: "2-digit",
|
|
633
|
-
day: "2-digit",
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Converts a date string to a North American date format.
|
|
639
|
-
* @param {String} dateStr - Date to validate.
|
|
640
|
-
* @param {String} format - Date format to validate against.
|
|
641
|
-
* @returns {String}
|
|
642
|
-
*/
|
|
643
|
-
function toNorthAmericanFormat(dateStr, format) {
|
|
644
|
-
if (format === "mm/dd/yyyy") {
|
|
645
|
-
return dateStr;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
const parsedDate = parseDate(dateStr, format);
|
|
649
|
-
|
|
650
|
-
if (!parsedDate) {
|
|
651
|
-
throw new Error(
|
|
652
|
-
"AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string",
|
|
653
|
-
);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
const { month, day, year } = parsedDate;
|
|
657
|
-
|
|
658
|
-
return [month, day, year].filter(Boolean).join("/");
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Validates that a date string matches the provided format and represents a real calendar date.
|
|
663
|
-
*
|
|
664
|
-
* @param {string} dateStr - Date string to validate.
|
|
665
|
-
* @param {string} [format="yyyy-mm-dd"] - Format of the date string.
|
|
666
|
-
* @returns {boolean} True when the date string is valid for the provided format, otherwise false.
|
|
667
|
-
*/
|
|
668
|
-
function isValidDate(dateStr, format = "yyyy-mm-dd") {
|
|
669
|
-
try {
|
|
670
|
-
if (typeof dateStr !== "string" || !dateStr || format?.length < 8) {
|
|
671
|
-
return false;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
if (parseDate(dateStr, format)) {
|
|
675
|
-
return true;
|
|
676
|
-
}
|
|
677
|
-
} catch (error) {
|
|
678
|
-
return false;
|
|
679
|
-
}
|
|
680
|
-
return false;
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Converts a JavaScript Date instance to a simple ISO-like date string. This returns only the calendar date portion without any time or timezone information.
|
|
685
|
-
*
|
|
686
|
-
* @param {Date} date - Date instance to convert to an ISO-like string.
|
|
687
|
-
* @returns {string} A string in the format "yyyy-mm-dd" representing the provided date.
|
|
688
|
-
* @throws {Error} Throws an error when the input is not a valid Date instance.
|
|
689
|
-
*/
|
|
690
|
-
function toISOFormatString(date) {
|
|
691
|
-
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
692
|
-
throw new Error(
|
|
693
|
-
"AuroDatepickerUtilities | toISOFormatString: Input must be a valid Date instance",
|
|
694
|
-
);
|
|
695
|
-
}
|
|
696
|
-
return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Converts a date string into a JavaScript Date instance. This method supports ISO formatted strings and other formats that can be parsed by the formatter.
|
|
701
|
-
*
|
|
702
|
-
* @param {String} dateStr - Date string to convert into a Date object.
|
|
703
|
-
* @param {String} format - Date format used to parse the string when it is not in ISO format.
|
|
704
|
-
* @returns {Date|null} Returns a Date instance for valid input or null for non-string input.
|
|
705
|
-
* @throws {Error} Throws when parsing fails for non-ISO string input.
|
|
706
|
-
*/
|
|
707
|
-
function stringToDateInstance(dateStr, format = "yyyy-mm-dd") {
|
|
708
|
-
if (typeof dateStr !== "string") {
|
|
709
|
-
return null;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
const { month, day, year } = parseDate(dateStr, format);
|
|
713
|
-
return new Date(`${year}/${month}/${day}`);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
const dateFormatter = {
|
|
717
|
-
parseDate,
|
|
718
|
-
getDateParts,
|
|
719
|
-
getDateAsString,
|
|
720
|
-
toNorthAmericanFormat,
|
|
721
|
-
isValidDate,
|
|
722
|
-
toISOFormatString,
|
|
723
|
-
stringToDateInstance,
|
|
724
|
-
};
|
|
725
|
-
|
|
726
495
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
727
496
|
// See LICENSE in the project root for license information.
|
|
728
497
|
|
|
@@ -944,7 +713,7 @@ class AuroFormValidation {
|
|
|
944
713
|
}
|
|
945
714
|
|
|
946
715
|
// Validate that the date passed was the correct format and is a valid date
|
|
947
|
-
if (elem.value && !
|
|
716
|
+
if (elem.value && !elem.valueObject) {
|
|
948
717
|
elem.validity = 'patternMismatch';
|
|
949
718
|
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || 'Invalid Date Format Entered';
|
|
950
719
|
return;
|
|
@@ -1444,7 +1213,7 @@ class AuroHelpText extends LitElement {
|
|
|
1444
1213
|
}
|
|
1445
1214
|
}
|
|
1446
1215
|
|
|
1447
|
-
var formkitVersion = '
|
|
1216
|
+
var formkitVersion = '202605271836';
|
|
1448
1217
|
|
|
1449
1218
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1450
1219
|
// See LICENSE in the project root for license information.
|
|
@@ -167,237 +167,6 @@ let AuroLibraryRuntimeUtils$4 = class AuroLibraryRuntimeUtils {
|
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
/**
|
|
171
|
-
* @description Splits a date string into its parts according to the provided format. Does NOT validate that the result is a real calendar date — use `parseDate` when validation is required.
|
|
172
|
-
* @param {string} dateStr - Date string to parse.
|
|
173
|
-
* @param {string} format - Date format to parse.
|
|
174
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
175
|
-
*/
|
|
176
|
-
function getDateParts$1(dateStr, format) {
|
|
177
|
-
if (!dateStr) {
|
|
178
|
-
return undefined;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const formatSeparatorMatch = format.match(/[/.-]/);
|
|
182
|
-
let valueParts;
|
|
183
|
-
let formatParts;
|
|
184
|
-
|
|
185
|
-
if (formatSeparatorMatch) {
|
|
186
|
-
const separator = formatSeparatorMatch[0];
|
|
187
|
-
valueParts = dateStr.split(separator);
|
|
188
|
-
formatParts = format.split(separator);
|
|
189
|
-
} else {
|
|
190
|
-
if (dateStr.match(/[/.-]/)) {
|
|
191
|
-
throw new Error(
|
|
192
|
-
"AuroDatepickerUtilities | parseDate: Date string has no separators",
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (dateStr.length !== format.length) {
|
|
197
|
-
throw new Error(
|
|
198
|
-
"AuroDatepickerUtilities | parseDate: Date string and format length do not match",
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
valueParts = [dateStr];
|
|
203
|
-
formatParts = [format];
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (valueParts.length !== formatParts.length) {
|
|
207
|
-
throw new Error(
|
|
208
|
-
`AuroDatepickerUtilities | parseDate: Date string and format do not match : ${dateStr} vs ${format}`,
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const result = formatParts.reduce((acc, part, index) => {
|
|
213
|
-
const value = valueParts[index];
|
|
214
|
-
|
|
215
|
-
if (/m/iu.test(part) && part.length === value.length) {
|
|
216
|
-
acc.month = value;
|
|
217
|
-
} else if (/d/iu.test(part) && part.length === value.length) {
|
|
218
|
-
acc.day = value;
|
|
219
|
-
} else if (/y/iu.test(part) && part.length === value.length) {
|
|
220
|
-
acc.year = value;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return acc;
|
|
224
|
-
}, {});
|
|
225
|
-
|
|
226
|
-
if (!result.month && !result.day && !result.year) {
|
|
227
|
-
throw new Error(
|
|
228
|
-
"AuroDatepickerUtilities | parseDate: Unable to parse date string",
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return result;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function isCalendarDate$1(year, month, day) {
|
|
236
|
-
let yearNumber = Number(year);
|
|
237
|
-
const monthNumber = Number(month);
|
|
238
|
-
const dayNumber = Number(day);
|
|
239
|
-
|
|
240
|
-
if (
|
|
241
|
-
!Number.isInteger(yearNumber) ||
|
|
242
|
-
!Number.isInteger(monthNumber) ||
|
|
243
|
-
!Number.isInteger(dayNumber)
|
|
244
|
-
) {
|
|
245
|
-
return false;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// Handle 2-digit years by converting them to 4-digit years based on a cutoff. This allows for parsing of 2-digit year formats while still validating the resulting date.
|
|
249
|
-
if (yearNumber < 100 && yearNumber >= 50) {
|
|
250
|
-
yearNumber += 1900;
|
|
251
|
-
} else if (yearNumber < 50) {
|
|
252
|
-
yearNumber += 2000;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const stringified = `${String(yearNumber).padStart(4, "0")}-${String(monthNumber).padStart(2, "0")}-${String(dayNumber).padStart(2, "0")}`;
|
|
256
|
-
const date = new Date(stringified.replace(/[.-]/g, "/"));
|
|
257
|
-
|
|
258
|
-
return (
|
|
259
|
-
!Number.isNaN(date.getTime()) && toISOFormatString$1(date) === stringified
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* @description Parses a date string into its components and validates that the result is a real calendar date. Use `getDateParts` instead when raw splitting without validation is needed (e.g. for in-progress input).
|
|
265
|
-
*
|
|
266
|
-
* Partial formats are supported: components absent from `format` default to `year → "0"`,
|
|
267
|
-
* `month → "01"`, `day → "01"` for calendar validation only. The returned object contains
|
|
268
|
-
* only the fields actually present in the format string — missing fields are never injected.
|
|
269
|
-
* @param {string} dateStr - Date string to parse.
|
|
270
|
-
* @param {string} format - Date format to parse.
|
|
271
|
-
* @returns {{ month?: string, day?: string, year?: string }|undefined}
|
|
272
|
-
* @throws {Error} Throws when the parsed result does not represent a valid calendar date.
|
|
273
|
-
*/
|
|
274
|
-
function parseDate$1(dateStr, format = "mm/dd/yyyy") {
|
|
275
|
-
if (!dateStr || !format) {
|
|
276
|
-
return undefined;
|
|
277
|
-
}
|
|
278
|
-
const result = getDateParts$1(dateStr.trim(), format);
|
|
279
|
-
|
|
280
|
-
if (!result) {
|
|
281
|
-
return undefined;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const lowerFormat = format.toLowerCase();
|
|
285
|
-
const year = lowerFormat.includes("yy") ? result.year : "0";
|
|
286
|
-
const month = lowerFormat.includes("mm") ? result.month : "01";
|
|
287
|
-
const day = lowerFormat.includes("dd") ? result.day : "01";
|
|
288
|
-
|
|
289
|
-
if (isCalendarDate$1(year, month, day)) {
|
|
290
|
-
return result;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
throw new Error(
|
|
294
|
-
`AuroDatepickerUtilities | parseDate: Date string is not a valid date ${JSON.stringify(result)} with format ${format}`,
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Convert a date object to string format.
|
|
300
|
-
* @param {Object} date - Date to convert to string.
|
|
301
|
-
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
302
|
-
* @returns {String} Returns the date as a string.
|
|
303
|
-
*/
|
|
304
|
-
function getDateAsString$1(date, locale = undefined) {
|
|
305
|
-
return date.toLocaleDateString(locale, {
|
|
306
|
-
year: "numeric",
|
|
307
|
-
month: "2-digit",
|
|
308
|
-
day: "2-digit",
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Converts a date string to a North American date format.
|
|
314
|
-
* @param {String} dateStr - Date to validate.
|
|
315
|
-
* @param {String} format - Date format to validate against.
|
|
316
|
-
* @returns {String}
|
|
317
|
-
*/
|
|
318
|
-
function toNorthAmericanFormat$1(dateStr, format) {
|
|
319
|
-
if (format === "mm/dd/yyyy") {
|
|
320
|
-
return dateStr;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const parsedDate = parseDate$1(dateStr, format);
|
|
324
|
-
|
|
325
|
-
if (!parsedDate) {
|
|
326
|
-
throw new Error(
|
|
327
|
-
"AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string",
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const { month, day, year } = parsedDate;
|
|
332
|
-
|
|
333
|
-
return [month, day, year].filter(Boolean).join("/");
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Validates that a date string matches the provided format and represents a real calendar date.
|
|
338
|
-
*
|
|
339
|
-
* @param {string} dateStr - Date string to validate.
|
|
340
|
-
* @param {string} [format="yyyy-mm-dd"] - Format of the date string.
|
|
341
|
-
* @returns {boolean} True when the date string is valid for the provided format, otherwise false.
|
|
342
|
-
*/
|
|
343
|
-
function isValidDate$1(dateStr, format = "yyyy-mm-dd") {
|
|
344
|
-
try {
|
|
345
|
-
if (typeof dateStr !== "string" || !dateStr || format?.length < 8) {
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (parseDate$1(dateStr, format)) {
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
} catch (error) {
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Converts a JavaScript Date instance to a simple ISO-like date string. This returns only the calendar date portion without any time or timezone information.
|
|
360
|
-
*
|
|
361
|
-
* @param {Date} date - Date instance to convert to an ISO-like string.
|
|
362
|
-
* @returns {string} A string in the format "yyyy-mm-dd" representing the provided date.
|
|
363
|
-
* @throws {Error} Throws an error when the input is not a valid Date instance.
|
|
364
|
-
*/
|
|
365
|
-
function toISOFormatString$1(date) {
|
|
366
|
-
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
367
|
-
throw new Error(
|
|
368
|
-
"AuroDatepickerUtilities | toISOFormatString: Input must be a valid Date instance",
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Converts a date string into a JavaScript Date instance. This method supports ISO formatted strings and other formats that can be parsed by the formatter.
|
|
376
|
-
*
|
|
377
|
-
* @param {String} dateStr - Date string to convert into a Date object.
|
|
378
|
-
* @param {String} format - Date format used to parse the string when it is not in ISO format.
|
|
379
|
-
* @returns {Date|null} Returns a Date instance for valid input or null for non-string input.
|
|
380
|
-
* @throws {Error} Throws when parsing fails for non-ISO string input.
|
|
381
|
-
*/
|
|
382
|
-
function stringToDateInstance$1(dateStr, format = "yyyy-mm-dd") {
|
|
383
|
-
if (typeof dateStr !== "string") {
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
const { month, day, year } = parseDate$1(dateStr, format);
|
|
388
|
-
return new Date(`${year}/${month}/${day}`);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const dateFormatter$1 = {
|
|
392
|
-
parseDate: parseDate$1,
|
|
393
|
-
getDateParts: getDateParts$1,
|
|
394
|
-
getDateAsString: getDateAsString$1,
|
|
395
|
-
toNorthAmericanFormat: toNorthAmericanFormat$1,
|
|
396
|
-
isValidDate: isValidDate$1,
|
|
397
|
-
toISOFormatString: toISOFormatString$1,
|
|
398
|
-
stringToDateInstance: stringToDateInstance$1,
|
|
399
|
-
};
|
|
400
|
-
|
|
401
170
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
402
171
|
// See LICENSE in the project root for license information.
|
|
403
172
|
|
|
@@ -619,7 +388,7 @@ let AuroFormValidation$1 = class AuroFormValidation {
|
|
|
619
388
|
}
|
|
620
389
|
|
|
621
390
|
// Validate that the date passed was the correct format and is a valid date
|
|
622
|
-
if (elem.value && !
|
|
391
|
+
if (elem.value && !elem.valueObject) {
|
|
623
392
|
elem.validity = 'patternMismatch';
|
|
624
393
|
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || 'Invalid Date Format Entered';
|
|
625
394
|
return;
|
|
@@ -5087,7 +4856,7 @@ let AuroHelpText$2 = class AuroHelpText extends i$4 {
|
|
|
5087
4856
|
}
|
|
5088
4857
|
};
|
|
5089
4858
|
|
|
5090
|
-
var formkitVersion$2 = '
|
|
4859
|
+
var formkitVersion$2 = '202605271836';
|
|
5091
4860
|
|
|
5092
4861
|
let AuroElement$2 = class AuroElement extends i$4 {
|
|
5093
4862
|
static get properties() {
|
|
@@ -10511,7 +10280,7 @@ class AuroFormValidation {
|
|
|
10511
10280
|
}
|
|
10512
10281
|
|
|
10513
10282
|
// Validate that the date passed was the correct format and is a valid date
|
|
10514
|
-
if (elem.value && !
|
|
10283
|
+
if (elem.value && !elem.valueObject) {
|
|
10515
10284
|
elem.validity = 'patternMismatch';
|
|
10516
10285
|
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || 'Invalid Date Format Entered';
|
|
10517
10286
|
return;
|
|
@@ -18345,7 +18114,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$4 {
|
|
|
18345
18114
|
}
|
|
18346
18115
|
};
|
|
18347
18116
|
|
|
18348
|
-
var formkitVersion$1 = '
|
|
18117
|
+
var formkitVersion$1 = '202605271836';
|
|
18349
18118
|
|
|
18350
18119
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
18351
18120
|
// See LICENSE in the project root for license information.
|
|
@@ -19462,7 +19231,7 @@ class AuroBibtemplate extends i$4 {
|
|
|
19462
19231
|
}
|
|
19463
19232
|
}
|
|
19464
19233
|
|
|
19465
|
-
var formkitVersion = '
|
|
19234
|
+
var formkitVersion = '202605271836';
|
|
19466
19235
|
|
|
19467
19236
|
var styleCss$3 = i$7`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;text-align:left}:host [auro-dropdown]{--ds-auro-dropdown-trigger-background-color: transparent}:host #inputInBib::part(wrapper){box-shadow:none}:host #inputInBib::part(accent-left){display:none}:host([layout*=classic]) [auro-input]{width:100%}:host([layout*=classic]) [auro-input]::part(helpText){display:none}:host([layout*=classic]) #slotHolder{display:none}`;
|
|
19468
19237
|
|