@luftborn/custom-elements 2.11.1 → 2.11.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/demo/index.min.js CHANGED
@@ -3375,7 +3375,7 @@ exports.CustomDatepickerStyles = "\n .custom-datepicker {\n position:
3375
3375
  },{}],17:[function(require,module,exports){
3376
3376
  "use strict";
3377
3377
  Object.defineProperty(exports, "__esModule", { value: true });
3378
- exports.convertStringToDate = exports.isMobileDevice = exports.formatDate = exports.supportedDateFormats = exports.defaultDateFormat = exports.daysOfWeek = exports.months = void 0;
3378
+ exports.validateDateString = exports.convertStringToDate = exports.isMobileDevice = exports.formatDate = exports.supportedDateFormats = exports.defaultDateFormat = exports.daysOfWeek = exports.months = void 0;
3379
3379
  var DatepickerTranslations_1 = require("./DatepickerTranslations");
3380
3380
  exports.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
3381
3381
  exports.daysOfWeek = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
@@ -3484,8 +3484,12 @@ function convertStringToDate(dateString, dateFormat, language) {
3484
3484
  }
3485
3485
  }
3486
3486
  exports.convertStringToDate = convertStringToDate;
3487
- function validateDateString(dateString, dateFormat, language) {
3487
+ function validateDateString(dateString, dateFormat, language, allowEmpty) {
3488
3488
  if (language === void 0) { language = 'en'; }
3489
+ if (allowEmpty === void 0) { allowEmpty = true; }
3490
+ if (allowEmpty && !dateString) {
3491
+ return true;
3492
+ }
3489
3493
  var dateFormatsRegex = exports.supportedDateFormats.reduce(function (acc, format) {
3490
3494
  acc[format] = new RegExp("^" + format.replace('yyyy', '\\d{4}')
3491
3495
  .replace('yy', '\\d{2}')
@@ -3496,6 +3500,7 @@ function validateDateString(dateString, dateFormat, language) {
3496
3500
  }, {});
3497
3501
  return dateFormatsRegex[dateFormat].test(dateString);
3498
3502
  }
3503
+ exports.validateDateString = validateDateString;
3499
3504
 
3500
3505
  },{"./DatepickerTranslations":18}],18:[function(require,module,exports){
3501
3506
  "use strict";
@@ -3842,7 +3847,7 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
3842
3847
  });
3843
3848
  Object.defineProperty(CustomFormatDateFieldElement.prototype, "valid", {
3844
3849
  get: function () {
3845
- return this.date.validity.valid;
3850
+ return (0, CustomDatepickerUtils_1.validateDateString)(this.value, this.dateFormat, this.language, !this.required);
3846
3851
  },
3847
3852
  enumerable: false,
3848
3853
  configurable: true