@syncfusion/ej2-base 31.1.22 → 31.2.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.
@@ -6450,6 +6450,19 @@ var DateParser = /** @__PURE__ @class */ (function () {
6450
6450
  }
6451
6451
  return null;
6452
6452
  };
6453
+ /**
6454
+ * Escapes all regex metacharacters in a string, preserving the {0} placeholder.
6455
+ *
6456
+ * @param {string} str ? - The input string to escape.
6457
+ * @returns {string} ? - The escaped string with {0} preserved.
6458
+ */
6459
+ DateParser.escapeRegex = function (str) {
6460
+ var tempPlaceholder = '__TEMP__';
6461
+ var tempStr = str.replace('{0}', tempPlaceholder);
6462
+ var metaChars = /[.*+?^${}()|[\]\\]/g;
6463
+ var escapedStr = tempStr.replace(metaChars, '\\$&');
6464
+ return escapedStr.replace(tempPlaceholder, '{0}');
6465
+ };
6453
6466
  /**
6454
6467
  * Returns parsed time zone RegExp for provided hour format and time zone
6455
6468
  *
@@ -6469,10 +6482,12 @@ var DateParser = /** @__PURE__ @class */ (function () {
6469
6482
  else {
6470
6483
  ret = ret.replace(/H|m/g, '(' + cRegex + '?)');
6471
6484
  }
6485
+ pattern = this.escapeRegex(pattern);
6472
6486
  var splitStr = (ret.split(';').map(function (str) {
6473
6487
  return pattern.replace('{0}', str);
6474
6488
  }));
6475
- ret = splitStr.join('|') + '|' + tZone.gmtZeroFormat;
6489
+ var gmtZeroFormat = this.escapeRegex(tZone.gmtZeroFormat);
6490
+ ret = splitStr.join('|') + '|' + gmtZeroFormat;
6476
6491
  return ret;
6477
6492
  };
6478
6493
  /**