@syncfusion/ej2-calendars 29.2.11 → 30.1.37

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.
@@ -98,10 +98,10 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
98
98
  this.calendarEleCopy = this.element.cloneNode(true);
99
99
  if (this.calendarMode === 'Islamic') {
100
100
  if (+(this.min.setSeconds(0)) === +new Date(1900, 0, 1, 0, 0, 0)) {
101
- this.min = new Date(1944, 2, 18);
101
+ this.min = new Date(1941, 12, 18);
102
102
  }
103
103
  if (+this.max === +new Date(2099, 11, 31)) {
104
- this.max = new Date(2069, 10, 16);
104
+ this.max = new Date(2068, 2, 4);
105
105
  }
106
106
  }
107
107
  this.globalize = new Internationalization(this.locale);
@@ -1964,10 +1964,10 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
1964
1964
  }
1965
1965
  else {
1966
1966
  var islamicDate = this.islamicModule.getIslamicDate(date);
1967
- return islamicDate.month >= (this.islamicModule.getIslamicDate(new Date(1944, 1, 18))).month
1968
- && islamicDate.year >= (this.islamicModule.getIslamicDate(new Date(1944, 1, 18))).year
1969
- && islamicDate.month <= (this.islamicModule.getIslamicDate(new Date(2069, 1, 16))).month
1970
- && islamicDate.year <= (this.islamicModule.getIslamicDate(new Date(2069, 1, 16))).year;
1967
+ return (islamicDate.month >= (this.islamicModule.getIslamicDate(new Date(1941, 12, 18))).month)
1968
+ && islamicDate.year >= (this.islamicModule.getIslamicDate(new Date(1941, 12, 18))).year
1969
+ && islamicDate.month <= (this.islamicModule.getIslamicDate(new Date(2068, 2, 4))).month
1970
+ && islamicDate.year <= (this.islamicModule.getIslamicDate(new Date(2068, 2, 4))).year;
1971
1971
  }
1972
1972
  };
1973
1973
  CalendarBase.prototype.compareYear = function (start, end) {
@@ -2732,7 +2732,7 @@ var TODAY$1 = 'e-today';
2732
2732
  var LINK$1 = 'e-day';
2733
2733
  var CELL$1 = 'e-cell';
2734
2734
  var dayMilliSeconds$1 = 86400000;
2735
- var minDecade = 2060;
2735
+ var minDecade = 2058;
2736
2736
  var maxDecade = 2069;
2737
2737
  var Islamic = /** @__PURE__ @class */ (function () {
2738
2738
  function Islamic(instance) {
@@ -3006,9 +3006,21 @@ var Islamic = /** @__PURE__ @class */ (function () {
3006
3006
  var endFullYr = endYr.getFullYear();
3007
3007
  var startHdrYr = this.calendarInstance.globalize.formatDate(startYr, { type: 'dateTime', format: 'y', calendar: 'islamic' });
3008
3008
  var endHdrYr = this.calendarInstance.globalize.formatDate(endYr, { type: 'dateTime', format: 'y', calendar: 'islamic' });
3009
+ if (islamicDate.year % 10 === 1) {
3010
+ startHdrYr = islamicDate.year;
3011
+ endHdrYr = islamicDate.year + 9;
3012
+ }
3013
+ else if (islamicDate.year % 10 > 1) {
3014
+ startHdrYr = islamicDate.year - ((islamicDate.year % 10) - 1);
3015
+ endHdrYr = startHdrYr + 9;
3016
+ }
3017
+ else if (islamicDate.year % 10 === 0) {
3018
+ startHdrYr = islamicDate.year - 9;
3019
+ endHdrYr = islamicDate.year;
3020
+ }
3009
3021
  if (this.calendarInstance.locale === 'ar') {
3010
- startHdrYr = Number(startHdrYr.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (d) { return String.fromCharCode(d.charCodeAt(0) - 1632 + 48); }));
3011
- endHdrYr = Number(endHdrYr.replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (d) { return String.fromCharCode(d.charCodeAt(0) - 1632 + 48); }));
3022
+ startHdrYr = Number(startHdrYr.toString().replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (d) { return String.fromCharCode(d.charCodeAt(0) - 1632 + 48); }));
3023
+ endHdrYr = Number(endHdrYr.toString().replace(/[٠١٢٣٤٥٦٧٨٩]/g, function (d) { return String.fromCharCode(d.charCodeAt(0) - 1632 + 48); }));
3012
3024
  }
3013
3025
  var splityear = this.calendarInstance.headerElement.textContent.split('-');
3014
3026
  if ((!isNullOrUndefined(e) && (splityear[0] !== startHdrYr) && e.action === 'home') ||
@@ -3107,6 +3119,10 @@ var Islamic = /** @__PURE__ @class */ (function () {
3107
3119
  if (islamicDate.year === parseInt(startHdrYr, 10) - 1 || (year_1 < startFullYr) ||
3108
3120
  (year_1 > endFullYr) && islamicDate.year !== parseInt(endHdrYr, 10)) {
3109
3121
  addClass([tdEle], OTHERMONTH$1);
3122
+ if (year_1 <= new Date(this.islamicInValue(this.calendarInstance.min)).getFullYear()
3123
+ || year_1 >= new Date(this.islamicInValue(this.calendarInstance.max)).getFullYear()) {
3124
+ addClass([tdEle], DISABLED$1);
3125
+ }
3110
3126
  }
3111
3127
  else if (year_1 < new Date(this.islamicInValue(this.calendarInstance.min)).getFullYear()
3112
3128
  || year_1 > new Date(this.islamicInValue(this.calendarInstance.max)).getFullYear()) {
@@ -3118,7 +3134,7 @@ var Islamic = /** @__PURE__ @class */ (function () {
3118
3134
  addClass([tdEle], SELECTED$1);
3119
3135
  }
3120
3136
  else {
3121
- if (localDate.getFullYear() === this.calendarInstance.currentDate.getFullYear() &&
3137
+ if (this.getIslamicDate(localDate).year === this.getIslamicDate(this.calendarInstance.currentDate).year &&
3122
3138
  !tdEle.classList.contains(DISABLED$1)) {
3123
3139
  addClass([tdEle], FOCUSEDDATE$1);
3124
3140
  }
@@ -5722,6 +5738,9 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5722
5738
  this.value = [new Date(rangeArray[0]), new Date(rangeArray[1])];
5723
5739
  }
5724
5740
  this.initProperty();
5741
+ if (this.inputFormats) {
5742
+ this.checkInputFormats();
5743
+ }
5725
5744
  this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : '0';
5726
5745
  this.element.removeAttribute('tabindex');
5727
5746
  _super.prototype.preRender.call(this);
@@ -5835,6 +5854,31 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5835
5854
  this.formatString = null;
5836
5855
  }
5837
5856
  };
5857
+ DateRangePicker.prototype.checkInputFormats = function () {
5858
+ this.inputFormatsString = [];
5859
+ if (this.inputFormats) {
5860
+ for (var _i = 0, _a = this.inputFormats; _i < _a.length; _i++) {
5861
+ var format = _a[_i];
5862
+ var formatString = '';
5863
+ if (typeof format === 'string') {
5864
+ formatString = format;
5865
+ }
5866
+ else if (format.skeleton !== '' && !isNullOrUndefined(format.skeleton)) {
5867
+ var skeletonString = format.skeleton;
5868
+ formatString = this.globalize.getDatePattern({ skeleton: skeletonString, type: 'date' });
5869
+ }
5870
+ if (formatString) {
5871
+ this.inputFormatsString.push(formatString);
5872
+ }
5873
+ }
5874
+ if (this.inputFormatsString.length === 0) {
5875
+ this.inputFormatsString = null;
5876
+ }
5877
+ }
5878
+ else {
5879
+ this.inputFormatsString = null;
5880
+ }
5881
+ };
5838
5882
  DateRangePicker.prototype.initialize = function () {
5839
5883
  if (this.angularTag !== null) {
5840
5884
  this.validationAttribute(this.element, this.inputElement);
@@ -6478,6 +6522,24 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6478
6522
  endDate = this.max;
6479
6523
  }
6480
6524
  }
6525
+ if (((isNullOrUndefined(startDate) || (typeof (startDate) === 'object' && isNaN(startDate.getTime()))
6526
+ || isNullOrUndefined(endDate)) || (typeof (endDate) === 'object' && isNaN(endDate.getTime())))
6527
+ && !isNullOrUndefined(this.inputFormatsString)) {
6528
+ for (var _i = 0, _a = this.inputFormatsString; _i < _a.length; _i++) {
6529
+ var format = _a[_i];
6530
+ var inputFormatOptions = { format: format, type: 'date', skeleton: 'yMd' };
6531
+ if (isNullOrUndefined(startDate) || (typeof (startDate) === 'object' && isNaN(startDate.getTime()))) {
6532
+ startDate = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), inputFormatOptions);
6533
+ }
6534
+ if (isNullOrUndefined(endDate) || (typeof (endDate) === 'object' && isNaN(endDate.getTime()))) {
6535
+ endDate = this.globalize.parseDate(this.getAmPmValue(range[1]).trim(), inputFormatOptions);
6536
+ }
6537
+ if (!isNullOrUndefined(startDate) && startDate instanceof Date && !isNaN(startDate.getTime())
6538
+ && !isNullOrUndefined(endDate) && endDate instanceof Date && !isNaN(endDate.getTime())) {
6539
+ break;
6540
+ }
6541
+ }
6542
+ }
6481
6543
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
6482
6544
  var prevStartVal = this.startValue;
6483
6545
  this.startValue = startDate;
@@ -9914,6 +9976,9 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9914
9976
  this.updateInput();
9915
9977
  this.changeTrigger();
9916
9978
  break;
9979
+ case 'inputFormats':
9980
+ this.checkInputFormats();
9981
+ break;
9917
9982
  case 'locale':
9918
9983
  this.globalize = new Internationalization(this.locale);
9919
9984
  this.l10n.setLocale(this.locale);
@@ -10179,6 +10244,9 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
10179
10244
  __decorate$2([
10180
10245
  Property(null)
10181
10246
  ], DateRangePicker.prototype, "format", void 0);
10247
+ __decorate$2([
10248
+ Property(null)
10249
+ ], DateRangePicker.prototype, "inputFormats", void 0);
10182
10250
  __decorate$2([
10183
10251
  Property(true)
10184
10252
  ], DateRangePicker.prototype, "enabled", void 0);