@aurodesignsystem-dev/auro-formkit 0.0.0-pr1489.5 → 0.0.0-pr1489.6

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.
Files changed (64) hide show
  1. package/components/checkbox/demo/customize.min.js +249 -125
  2. package/components/checkbox/demo/getting-started.min.js +249 -125
  3. package/components/checkbox/demo/index.min.js +249 -125
  4. package/components/checkbox/demo/styles.min.css +1 -1
  5. package/components/checkbox/dist/index.js +249 -125
  6. package/components/checkbox/dist/registered.js +249 -125
  7. package/components/combobox/demo/customize.min.js +502 -254
  8. package/components/combobox/demo/getting-started.min.js +502 -254
  9. package/components/combobox/demo/index.min.js +502 -254
  10. package/components/combobox/demo/styles.min.css +1 -1
  11. package/components/combobox/dist/index.js +502 -254
  12. package/components/combobox/dist/registered.js +502 -254
  13. package/components/counter/demo/customize.min.js +250 -126
  14. package/components/counter/demo/index.min.js +250 -126
  15. package/components/counter/demo/styles.min.css +1 -1
  16. package/components/counter/dist/index.js +249 -125
  17. package/components/counter/dist/registered.js +249 -125
  18. package/components/datepicker/demo/accessibility.md +9 -6
  19. package/components/datepicker/demo/api.md +1 -1
  20. package/components/datepicker/demo/customize.min.js +1544 -527
  21. package/components/datepicker/demo/index.md +6 -4
  22. package/components/datepicker/demo/index.min.js +1560 -532
  23. package/components/datepicker/demo/keyboard-behavior.md +15 -15
  24. package/components/datepicker/demo/styles.min.css +1 -1
  25. package/components/datepicker/demo/voiceover.md +5 -3
  26. package/components/datepicker/demo/why-datepicker.md +2 -2
  27. package/components/datepicker/dist/index.js +1536 -519
  28. package/components/datepicker/dist/registered.js +1536 -519
  29. package/components/datepicker/dist/src/auro-calendar-cell.d.ts +50 -15
  30. package/components/datepicker/dist/src/auro-calendar-month.d.ts +9 -0
  31. package/components/datepicker/dist/src/auro-calendar.d.ts +161 -8
  32. package/components/datepicker/dist/src/auro-datepicker.d.ts +5 -7
  33. package/components/dropdown/demo/customize.min.js +1 -1
  34. package/components/dropdown/demo/getting-started.min.js +1 -1
  35. package/components/dropdown/demo/index.min.js +1 -1
  36. package/components/dropdown/demo/styles.min.css +1 -1
  37. package/components/dropdown/dist/index.js +1 -1
  38. package/components/dropdown/dist/registered.js +1 -1
  39. package/components/form/demo/customize.min.js +3263 -1378
  40. package/components/form/demo/getting-started.min.js +3263 -1378
  41. package/components/form/demo/index.min.js +3263 -1378
  42. package/components/form/demo/registerDemoDeps.min.js +3263 -1378
  43. package/components/form/demo/styles.min.css +1 -1
  44. package/components/input/demo/customize.min.js +249 -125
  45. package/components/input/demo/getting-started.min.js +249 -125
  46. package/components/input/demo/index.min.js +249 -125
  47. package/components/input/demo/styles.min.css +1 -1
  48. package/components/input/dist/index.js +249 -125
  49. package/components/input/dist/registered.js +249 -125
  50. package/components/menu/demo/styles.min.css +1 -1
  51. package/components/radio/demo/customize.min.js +249 -125
  52. package/components/radio/demo/getting-started.min.js +249 -125
  53. package/components/radio/demo/index.min.js +249 -125
  54. package/components/radio/demo/styles.min.css +1 -1
  55. package/components/radio/dist/index.js +249 -125
  56. package/components/radio/dist/registered.js +249 -125
  57. package/components/select/demo/customize.min.js +250 -126
  58. package/components/select/demo/getting-started.min.js +250 -126
  59. package/components/select/demo/index.min.js +250 -126
  60. package/components/select/demo/styles.min.css +1 -1
  61. package/components/select/dist/index.js +250 -126
  62. package/components/select/dist/registered.js +250 -126
  63. package/custom-elements.json +1818 -1491
  64. package/package.json +8 -8
@@ -3992,109 +3992,236 @@ class AuroInputUtilities {
3992
3992
  }
3993
3993
  }
3994
3994
 
3995
- class DateFormatter {
3995
+ /**
3996
+ * @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.
3997
+ * @param {string} dateStr - Date string to parse.
3998
+ * @param {string} format - Date format to parse.
3999
+ * @returns {{ month?: string, day?: string, year?: string }|undefined}
4000
+ */
4001
+ function getDateParts(dateStr, format) {
4002
+ if (!dateStr) {
4003
+ return undefined;
4004
+ }
3996
4005
 
3997
- constructor() {
4006
+ const formatSeparatorMatch = format.match(/[/.-]/);
4007
+ let valueParts;
4008
+ let formatParts;
3998
4009
 
3999
- /**
4000
- * @description Parses a date string into its components.
4001
- * @param {string} dateStr - Date string to parse.
4002
- * @param {string} format - Date format to parse.
4003
- * @returns {Object<key["month" | "day" | "year"]: number>|undefined}
4004
- */
4005
- this.parseDate = (dateStr, format = 'mm/dd/yyyy') => {
4010
+ if (formatSeparatorMatch) {
4011
+ const separator = formatSeparatorMatch[0];
4012
+ valueParts = dateStr.split(separator);
4013
+ formatParts = format.split(separator);
4014
+ } else {
4015
+ if (dateStr.match(/[/.-]/)) {
4016
+ throw new Error(
4017
+ "AuroDatepickerUtilities | parseDate: Date string has no separators",
4018
+ );
4019
+ }
4006
4020
 
4007
- // Guard Clause: Date string is defined
4008
- if (!dateStr) {
4009
- return undefined;
4010
- }
4021
+ if (dateStr.length !== format.length) {
4022
+ throw new Error(
4023
+ "AuroDatepickerUtilities | parseDate: Date string and format length do not match",
4024
+ );
4025
+ }
4011
4026
 
4012
- // Assume the separator is a "/" a defined in our code base
4013
- const separator = '/';
4027
+ valueParts = [dateStr];
4028
+ formatParts = [format];
4029
+ }
4014
4030
 
4015
- // Get the parts of the date and format
4016
- const valueParts = dateStr.split(separator);
4017
- const formatParts = format.split(separator);
4031
+ if (valueParts.length !== formatParts.length) {
4032
+ throw new Error(
4033
+ `AuroDatepickerUtilities | parseDate: Date string and format do not match : ${dateStr} vs ${format}`,
4034
+ );
4035
+ }
4018
4036
 
4019
- // Check if the value and format have the correct number of parts
4020
- if (valueParts.length !== formatParts.length) {
4021
- throw new Error('AuroDatepickerUtilities | parseDate: Date string and format length do not match');
4022
- }
4037
+ const result = formatParts.reduce((acc, part, index) => {
4038
+ const value = valueParts[index];
4023
4039
 
4024
- // Holds the result to be returned
4025
- const result = formatParts.reduce((acc, part, index) => {
4026
- const value = valueParts[index];
4040
+ if (/m/iu.test(part) && part.length === value.length) {
4041
+ acc.month = value;
4042
+ } else if (/d/iu.test(part) && part.length === value.length) {
4043
+ acc.day = value;
4044
+ } else if (/y/iu.test(part) && part.length === value.length) {
4045
+ acc.year = value;
4046
+ }
4027
4047
 
4028
- if ((/m/iu).test(part)) {
4029
- acc.month = value;
4030
- } else if ((/d/iu).test(part)) {
4031
- acc.day = value;
4032
- } else if ((/y/iu).test(part)) {
4033
- acc.year = value;
4034
- }
4048
+ return acc;
4049
+ }, {});
4035
4050
 
4036
- return acc;
4037
- }, {});
4051
+ if (!result.month && !result.day && !result.year) {
4052
+ throw new Error(
4053
+ "AuroDatepickerUtilities | parseDate: Unable to parse date string",
4054
+ );
4055
+ }
4038
4056
 
4039
- // If we found all the parts, return the result
4040
- if (result.month && result.year) {
4041
- return result;
4042
- }
4057
+ return result;
4058
+ }
4043
4059
 
4044
- // Throw an error to let the dev know we were unable to parse the date string
4045
- throw new Error('AuroDatepickerUtilities | parseDate: Unable to parse date string');
4046
- };
4060
+ function isCalendarDate(year, month, day) {
4061
+ let yearNumber = Number(year);
4062
+ const monthNumber = Number(month);
4063
+ const dayNumber = Number(day);
4047
4064
 
4048
- /**
4049
- * Convert a date object to string format.
4050
- * @param {Object} date - Date to convert to string.
4051
- * @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
4052
- * @returns {String} Returns the date as a string.
4053
- */
4054
- this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
4055
- year: "numeric",
4056
- month: "2-digit",
4057
- day: "2-digit",
4058
- });
4065
+ if (
4066
+ !Number.isInteger(yearNumber) ||
4067
+ !Number.isInteger(monthNumber) ||
4068
+ !Number.isInteger(dayNumber)
4069
+ ) {
4070
+ return false;
4071
+ }
4059
4072
 
4060
- /**
4061
- * Converts a date string to a North American date format.
4062
- * @param {String} dateStr - Date to validate.
4063
- * @param {String} format - Date format to validate against.
4064
- * @returns {Boolean}
4065
- */
4066
- this.toNorthAmericanFormat = (dateStr, format) => {
4073
+ // 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.
4074
+ if (yearNumber < 100 && yearNumber >= 50) {
4075
+ yearNumber += 1900;
4076
+ } else if (yearNumber < 50) {
4077
+ yearNumber += 2000;
4078
+ }
4067
4079
 
4068
- if (format === 'mm/dd/yyyy') {
4069
- return dateStr;
4070
- }
4080
+ const stringified = `${String(yearNumber).padStart(4, "0")}-${String(monthNumber).padStart(2, "0")}-${String(dayNumber).padStart(2, "0")}`;
4081
+ const date = new Date(stringified.replace(/[.-]/g, "/"));
4071
4082
 
4072
- const parsedDate = this.parseDate(dateStr, format);
4083
+ return (
4084
+ !Number.isNaN(date.getTime()) && toISOFormatString(date) === stringified
4085
+ );
4086
+ }
4073
4087
 
4074
- if (!parsedDate) {
4075
- throw new Error('AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string');
4076
- }
4088
+ /**
4089
+ * @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).
4090
+ *
4091
+ * Partial formats are supported: components absent from `format` default to `year → "0"`,
4092
+ * `month → "01"`, `day → "01"` for calendar validation only. The returned object contains
4093
+ * only the fields actually present in the format string — missing fields are never injected.
4094
+ * @param {string} dateStr - Date string to parse.
4095
+ * @param {string} format - Date format to parse.
4096
+ * @returns {{ month?: string, day?: string, year?: string }|undefined}
4097
+ * @throws {Error} Throws when the parsed result does not represent a valid calendar date.
4098
+ */
4099
+ function parseDate(dateStr, format = "mm/dd/yyyy") {
4100
+ if (!dateStr || !format) {
4101
+ return undefined;
4102
+ }
4103
+ const result = getDateParts(dateStr.trim(), format);
4077
4104
 
4078
- const { month, day, year } = parsedDate;
4105
+ if (!result) {
4106
+ return undefined;
4107
+ }
4079
4108
 
4080
- const dateParts = [];
4081
- if (month) {
4082
- dateParts.push(month);
4083
- }
4109
+ const lowerFormat = format.toLowerCase();
4110
+ const year = lowerFormat.includes("yy") ? result.year : "0";
4111
+ const month = lowerFormat.includes("mm") ? result.month : "01";
4112
+ const day = lowerFormat.includes("dd") ? result.day : "01";
4084
4113
 
4085
- if (day) {
4086
- dateParts.push(day);
4087
- }
4114
+ if (isCalendarDate(year, month, day)) {
4115
+ return result;
4116
+ }
4088
4117
 
4089
- if (year) {
4090
- dateParts.push(year);
4091
- }
4118
+ throw new Error(
4119
+ `AuroDatepickerUtilities | parseDate: Date string is not a valid date ${JSON.stringify(result)} with format ${format}`,
4120
+ );
4121
+ }
4092
4122
 
4093
- return dateParts.join('/');
4094
- };
4123
+ /**
4124
+ * Convert a date object to string format.
4125
+ * @param {Object} date - Date to convert to string.
4126
+ * @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
4127
+ * @returns {String} Returns the date as a string.
4128
+ */
4129
+ function getDateAsString(date, locale = undefined) {
4130
+ return date.toLocaleDateString(locale, {
4131
+ year: "numeric",
4132
+ month: "2-digit",
4133
+ day: "2-digit",
4134
+ });
4135
+ }
4136
+
4137
+ /**
4138
+ * Converts a date string to a North American date format.
4139
+ * @param {String} dateStr - Date to validate.
4140
+ * @param {String} format - Date format to validate against.
4141
+ * @returns {String}
4142
+ */
4143
+ function toNorthAmericanFormat$1(dateStr, format) {
4144
+ if (format === "mm/dd/yyyy") {
4145
+ return dateStr;
4095
4146
  }
4147
+
4148
+ const parsedDate = parseDate(dateStr, format);
4149
+
4150
+ if (!parsedDate) {
4151
+ throw new Error(
4152
+ "AuroDatepickerUtilities | toNorthAmericanFormat: Unable to parse date string",
4153
+ );
4154
+ }
4155
+
4156
+ const { month, day, year } = parsedDate;
4157
+
4158
+ return [month, day, year].filter(Boolean).join("/");
4096
4159
  }
4097
- const dateFormatter = new DateFormatter();
4160
+
4161
+ /**
4162
+ * Validates that a date string matches the provided format and represents a real calendar date.
4163
+ *
4164
+ * @param {string} dateStr - Date string to validate.
4165
+ * @param {string} [format="yyyy-mm-dd"] - Format of the date string.
4166
+ * @returns {boolean} True when the date string is valid for the provided format, otherwise false.
4167
+ */
4168
+ function isValidDate(dateStr, format = "yyyy-mm-dd") {
4169
+ try {
4170
+ if (typeof dateStr !== "string" || !dateStr || format?.length < 8) {
4171
+ return false;
4172
+ }
4173
+
4174
+ if (parseDate(dateStr, format)) {
4175
+ return true;
4176
+ }
4177
+ } catch (error) {
4178
+ return false;
4179
+ }
4180
+ return false;
4181
+ }
4182
+
4183
+ /**
4184
+ * 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.
4185
+ *
4186
+ * @param {Date} date - Date instance to convert to an ISO-like string.
4187
+ * @returns {string} A string in the format "yyyy-mm-dd" representing the provided date.
4188
+ * @throws {Error} Throws an error when the input is not a valid Date instance.
4189
+ */
4190
+ function toISOFormatString(date) {
4191
+ if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
4192
+ throw new Error(
4193
+ "AuroDatepickerUtilities | toISOFormatString: Input must be a valid Date instance",
4194
+ );
4195
+ }
4196
+ return `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
4197
+ }
4198
+
4199
+ /**
4200
+ * 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.
4201
+ *
4202
+ * @param {String} dateStr - Date string to convert into a Date object.
4203
+ * @param {String} format - Date format used to parse the string when it is not in ISO format.
4204
+ * @returns {Date|null} Returns a Date instance for valid input or null for non-string input.
4205
+ * @throws {Error} Throws when parsing fails for non-ISO string input.
4206
+ */
4207
+ function stringToDateInstance(dateStr, format = "yyyy-mm-dd") {
4208
+ if (typeof dateStr !== "string") {
4209
+ return null;
4210
+ }
4211
+
4212
+ const { month, day, year } = parseDate(dateStr, format);
4213
+ return new Date(`${year}/${month}/${day}`);
4214
+ }
4215
+
4216
+ const dateFormatter = {
4217
+ parseDate,
4218
+ getDateParts,
4219
+ getDateAsString,
4220
+ toNorthAmericanFormat: toNorthAmericanFormat$1,
4221
+ isValidDate,
4222
+ toISOFormatString,
4223
+ stringToDateInstance,
4224
+ };
4098
4225
 
4099
4226
  // filepath: dateConstraints.mjs
4100
4227
  const DATE_UTIL_CONSTRAINTS = {
@@ -4166,12 +4293,11 @@ class AuroDateUtilitiesBase {
4166
4293
  /* eslint-disable no-magic-numbers */
4167
4294
 
4168
4295
  class AuroDateUtilities extends AuroDateUtilitiesBase {
4169
-
4170
4296
  /**
4171
4297
  * Returns the current century.
4172
4298
  * @returns {String} The current century.
4173
4299
  */
4174
- getCentury () {
4300
+ getCentury() {
4175
4301
  return String(new Date().getFullYear()).slice(0, 2);
4176
4302
  }
4177
4303
 
@@ -4180,14 +4306,12 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4180
4306
  * @param {String} year - The year to convert to four digits.
4181
4307
  * @returns {String} The four digit year.
4182
4308
  */
4183
- getFourDigitYear (year) {
4184
-
4309
+ getFourDigitYear(year) {
4185
4310
  const strYear = String(year).trim();
4186
4311
  return strYear.length <= 2 ? this.getCentury() + strYear : strYear;
4187
4312
  }
4188
4313
 
4189
4314
  constructor() {
4190
-
4191
4315
  super();
4192
4316
 
4193
4317
  /**
@@ -4196,7 +4320,8 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4196
4320
  * @param {Object} date2 - Second date to compare.
4197
4321
  * @returns {Boolean} Returns true if the dates match.
4198
4322
  */
4199
- this.datesMatch = (date1, date2) => new Date(date1).getTime() === new Date(date2).getTime();
4323
+ this.datesMatch = (date1, date2) =>
4324
+ new Date(date1).getTime() === new Date(date2).getTime();
4200
4325
 
4201
4326
  /**
4202
4327
  * Returns true if value passed in is a valid date.
@@ -4205,53 +4330,41 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4205
4330
  * @returns {Boolean}
4206
4331
  */
4207
4332
  this.validDateStr = (date, format) => {
4208
-
4209
4333
  // The length we expect the date string to be
4210
- const dateStrLength = format.length;
4334
+ const dateStrLength = format?.length || 0;
4211
4335
 
4212
4336
  // Guard Clause: Date and format are defined
4213
4337
  if (typeof date === "undefined" || typeof format === "undefined") {
4214
- throw new Error('AuroDatepickerUtilities | validateDateStr: Date and format are required');
4338
+ throw new Error(
4339
+ "AuroDatepickerUtilities | validateDateStr: Date and format are required",
4340
+ );
4215
4341
  }
4216
4342
 
4217
4343
  // Guard Clause: Date should be of type string
4218
4344
  if (typeof date !== "string") {
4219
- throw new Error('AuroDatepickerUtilities | validateDateStr: Date must be a string');
4345
+ throw new Error(
4346
+ "AuroDatepickerUtilities | validateDateStr: Date must be a string",
4347
+ );
4220
4348
  }
4221
4349
 
4222
4350
  // Guard Clause: Format should be of type string
4223
4351
  if (typeof format !== "string") {
4224
- throw new Error('AuroDatepickerUtilities | validateDateStr: Format must be a string');
4352
+ throw new Error(
4353
+ "AuroDatepickerUtilities | validateDateStr: Format must be a string",
4354
+ );
4225
4355
  }
4226
4356
 
4227
4357
  // Guard Clause: Length is what we expect it to be
4228
4358
  if (date.length !== dateStrLength) {
4229
4359
  return false;
4230
4360
  }
4231
- // Get a formatted date string and parse it
4232
- const dateParts = dateFormatter.parseDate(date, format);
4233
-
4234
- // Guard Clause: Date parse succeeded
4235
- if (!dateParts) {
4236
- return false;
4237
- }
4238
-
4239
- // Create the expected date string based on the date parts
4240
- const expectedDateStr = `${dateParts.month}/${dateParts.day || "01"}/${this.getFourDigitYear(dateParts.year)}`;
4241
-
4242
- // Generate a date object that we will extract a string date from to compare to the passed in date string
4243
- const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
4244
-
4245
- // Get the date string of the date object we created from the string date
4246
- const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
4247
4361
 
4248
- // Guard Clause: Generated date matches date string input
4249
- if (expectedDateStr !== actualDateStr) {
4362
+ // Get a formatted date string and parse and validate it
4363
+ try {
4364
+ return Boolean(dateFormatter.parseDate(date, format));
4365
+ } catch (error) {
4250
4366
  return false;
4251
4367
  }
4252
-
4253
- // If we passed all other checks, we can assume the date is valid
4254
- return true;
4255
4368
  };
4256
4369
 
4257
4370
  /**
@@ -4261,10 +4374,11 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4261
4374
  * @returns {boolean}
4262
4375
  */
4263
4376
  this.dateAndFormatMatch = (value, format) => {
4264
-
4265
4377
  // Ensure we have both values we need to do the comparison
4266
4378
  if (!value || !format) {
4267
- throw new Error('AuroFormValidation | dateFormatMatch: value and format are required');
4379
+ throw new Error(
4380
+ "AuroFormValidation | dateFormatMatch: value and format are required",
4381
+ );
4268
4382
  }
4269
4383
 
4270
4384
  // If the lengths are different, they cannot match
@@ -4273,11 +4387,10 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4273
4387
  }
4274
4388
 
4275
4389
  // Get the parts of the date
4276
- const dateParts = dateFormatter.parseDate(value, format);
4390
+ const dateParts = dateFormatter.getDateParts(value, format);
4277
4391
 
4278
4392
  // Validator for day
4279
4393
  const dayValueIsValid = (day) => {
4280
-
4281
4394
  // Guard clause: if there is no day in the dateParts, we can ignore this check.
4282
4395
  if (!dateParts.day) {
4283
4396
  return true;
@@ -4293,7 +4406,9 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4293
4406
 
4294
4407
  // Guard clause: ensure day is a valid integer
4295
4408
  if (Number.isNaN(numDay)) {
4296
- throw new Error('AuroDatepickerUtilities | dayValueIsValid: Unable to parse day value integer');
4409
+ throw new Error(
4410
+ "AuroDatepickerUtilities | dayValueIsValid: Unable to parse day value integer",
4411
+ );
4297
4412
  }
4298
4413
 
4299
4414
  // Guard clause: ensure day is within the valid range
@@ -4307,6 +4422,10 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4307
4422
 
4308
4423
  // Validator for month
4309
4424
  const monthValueIsValid = (month) => {
4425
+ // Guard clause: if there is no month in the dateParts, we can ignore this check.
4426
+ if (!dateParts.month) {
4427
+ return true;
4428
+ }
4310
4429
 
4311
4430
  // Guard clause: ensure month exists.
4312
4431
  if (!month) {
@@ -4318,7 +4437,9 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4318
4437
 
4319
4438
  // Guard clause: ensure month is a valid integer
4320
4439
  if (Number.isNaN(numMonth)) {
4321
- throw new Error('AuroDatepickerUtilities | monthValueIsValid: Unable to parse month value integer');
4440
+ throw new Error(
4441
+ "AuroDatepickerUtilities | monthValueIsValid: Unable to parse month value integer",
4442
+ );
4322
4443
  }
4323
4444
 
4324
4445
  // Guard clause: ensure month is within the valid range
@@ -4332,6 +4453,10 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4332
4453
 
4333
4454
  // Validator for year
4334
4455
  const yearIsValid = (_year) => {
4456
+ // Guard clause: if there is no year in the dateParts, we can ignore this check.
4457
+ if (!dateParts.year) {
4458
+ return true;
4459
+ }
4335
4460
 
4336
4461
  // Guard clause: ensure year exists.
4337
4462
  if (!_year) {
@@ -4346,7 +4471,9 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4346
4471
 
4347
4472
  // Guard clause: ensure year is a valid integer
4348
4473
  if (Number.isNaN(numYear)) {
4349
- throw new Error('AuroDatepickerUtilities | yearValueIsValid: Unable to parse year value integer');
4474
+ throw new Error(
4475
+ "AuroDatepickerUtilities | yearValueIsValid: Unable to parse year value integer",
4476
+ );
4350
4477
  }
4351
4478
 
4352
4479
  // Guard clause: ensure year is within the valid range
@@ -4362,7 +4489,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
4362
4489
  const checks = [
4363
4490
  monthValueIsValid(dateParts.month),
4364
4491
  dayValueIsValid(dateParts.day),
4365
- yearIsValid(dateParts.year)
4492
+ yearIsValid(dateParts.year),
4366
4493
  ];
4367
4494
 
4368
4495
  // If any of the checks failed, the date format does not match and the result is invalid
@@ -4396,10 +4523,7 @@ const {
4396
4523
  } = dateUtilities;
4397
4524
 
4398
4525
  const {
4399
- toNorthAmericanFormat,
4400
- parseDate,
4401
- getDateAsString
4402
- } = dateFormatter;
4526
+ toNorthAmericanFormat} = dateFormatter;
4403
4527
 
4404
4528
  // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
4405
4529
  // See LICENSE in the project root for license information.
@@ -6614,7 +6738,7 @@ class AuroHelpText extends LitElement {
6614
6738
  }
6615
6739
  }
6616
6740
 
6617
- var formkitVersion = '202606011922';
6741
+ var formkitVersion = '202606012139';
6618
6742
 
6619
6743
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
6620
6744
  // See LICENSE in the project root for license information.