@syncfusion/ej2-calendars 29.2.10 → 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.
@@ -83,10 +83,10 @@ let CalendarBase = class CalendarBase extends Component {
83
83
  this.calendarEleCopy = this.element.cloneNode(true);
84
84
  if (this.calendarMode === 'Islamic') {
85
85
  if (+(this.min.setSeconds(0)) === +new Date(1900, 0, 1, 0, 0, 0)) {
86
- this.min = new Date(1944, 2, 18);
86
+ this.min = new Date(1941, 12, 18);
87
87
  }
88
88
  if (+this.max === +new Date(2099, 11, 31)) {
89
- this.max = new Date(2069, 10, 16);
89
+ this.max = new Date(2068, 2, 4);
90
90
  }
91
91
  }
92
92
  this.globalize = new Internationalization(this.locale);
@@ -1946,10 +1946,10 @@ let CalendarBase = class CalendarBase extends Component {
1946
1946
  }
1947
1947
  else {
1948
1948
  const islamicDate = this.islamicModule.getIslamicDate(date);
1949
- return islamicDate.month >= (this.islamicModule.getIslamicDate(new Date(1944, 1, 18))).month
1950
- && islamicDate.year >= (this.islamicModule.getIslamicDate(new Date(1944, 1, 18))).year
1951
- && islamicDate.month <= (this.islamicModule.getIslamicDate(new Date(2069, 1, 16))).month
1952
- && islamicDate.year <= (this.islamicModule.getIslamicDate(new Date(2069, 1, 16))).year;
1949
+ return (islamicDate.month >= (this.islamicModule.getIslamicDate(new Date(1941, 12, 18))).month)
1950
+ && islamicDate.year >= (this.islamicModule.getIslamicDate(new Date(1941, 12, 18))).year
1951
+ && islamicDate.month <= (this.islamicModule.getIslamicDate(new Date(2068, 2, 4))).month
1952
+ && islamicDate.year <= (this.islamicModule.getIslamicDate(new Date(2068, 2, 4))).year;
1953
1953
  }
1954
1954
  }
1955
1955
  compareYear(start, end) {
@@ -2709,7 +2709,7 @@ const TODAY$1 = 'e-today';
2709
2709
  const LINK$1 = 'e-day';
2710
2710
  const CELL$1 = 'e-cell';
2711
2711
  const dayMilliSeconds$1 = 86400000;
2712
- const minDecade = 2060;
2712
+ const minDecade = 2058;
2713
2713
  const maxDecade = 2069;
2714
2714
  class Islamic {
2715
2715
  constructor(instance) {
@@ -2983,9 +2983,21 @@ class Islamic {
2983
2983
  let endFullYr = endYr.getFullYear();
2984
2984
  let startHdrYr = this.calendarInstance.globalize.formatDate(startYr, { type: 'dateTime', format: 'y', calendar: 'islamic' });
2985
2985
  let endHdrYr = this.calendarInstance.globalize.formatDate(endYr, { type: 'dateTime', format: 'y', calendar: 'islamic' });
2986
+ if (islamicDate.year % 10 === 1) {
2987
+ startHdrYr = islamicDate.year;
2988
+ endHdrYr = islamicDate.year + 9;
2989
+ }
2990
+ else if (islamicDate.year % 10 > 1) {
2991
+ startHdrYr = islamicDate.year - ((islamicDate.year % 10) - 1);
2992
+ endHdrYr = startHdrYr + 9;
2993
+ }
2994
+ else if (islamicDate.year % 10 === 0) {
2995
+ startHdrYr = islamicDate.year - 9;
2996
+ endHdrYr = islamicDate.year;
2997
+ }
2986
2998
  if (this.calendarInstance.locale === 'ar') {
2987
- startHdrYr = Number(startHdrYr.replace(/[٠١٢٣٤٥٦٧٨٩]/g, (d) => String.fromCharCode(d.charCodeAt(0) - 1632 + 48)));
2988
- endHdrYr = Number(endHdrYr.replace(/[٠١٢٣٤٥٦٧٨٩]/g, (d) => String.fromCharCode(d.charCodeAt(0) - 1632 + 48)));
2999
+ startHdrYr = Number(startHdrYr.toString().replace(/[٠١٢٣٤٥٦٧٨٩]/g, (d) => String.fromCharCode(d.charCodeAt(0) - 1632 + 48)));
3000
+ endHdrYr = Number(endHdrYr.toString().replace(/[٠١٢٣٤٥٦٧٨٩]/g, (d) => String.fromCharCode(d.charCodeAt(0) - 1632 + 48)));
2989
3001
  }
2990
3002
  const splityear = this.calendarInstance.headerElement.textContent.split('-');
2991
3003
  if ((!isNullOrUndefined(e) && (splityear[0] !== startHdrYr) && e.action === 'home') ||
@@ -3084,6 +3096,10 @@ class Islamic {
3084
3096
  if (islamicDate.year === parseInt(startHdrYr, 10) - 1 || (year < startFullYr) ||
3085
3097
  (year > endFullYr) && islamicDate.year !== parseInt(endHdrYr, 10)) {
3086
3098
  addClass([tdEle], OTHERMONTH$1);
3099
+ if (year <= new Date(this.islamicInValue(this.calendarInstance.min)).getFullYear()
3100
+ || year >= new Date(this.islamicInValue(this.calendarInstance.max)).getFullYear()) {
3101
+ addClass([tdEle], DISABLED$1);
3102
+ }
3087
3103
  }
3088
3104
  else if (year < new Date(this.islamicInValue(this.calendarInstance.min)).getFullYear()
3089
3105
  || year > new Date(this.islamicInValue(this.calendarInstance.max)).getFullYear()) {
@@ -3095,7 +3111,7 @@ class Islamic {
3095
3111
  addClass([tdEle], SELECTED$1);
3096
3112
  }
3097
3113
  else {
3098
- if (localDate.getFullYear() === this.calendarInstance.currentDate.getFullYear() &&
3114
+ if (this.getIslamicDate(localDate).year === this.getIslamicDate(this.calendarInstance.currentDate).year &&
3099
3115
  !tdEle.classList.contains(DISABLED$1)) {
3100
3116
  addClass([tdEle], FOCUSEDDATE$1);
3101
3117
  }
@@ -5648,6 +5664,9 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5648
5664
  this.value = [new Date(rangeArray[0]), new Date(rangeArray[1])];
5649
5665
  }
5650
5666
  this.initProperty();
5667
+ if (this.inputFormats) {
5668
+ this.checkInputFormats();
5669
+ }
5651
5670
  this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : '0';
5652
5671
  this.element.removeAttribute('tabindex');
5653
5672
  super.preRender();
@@ -5761,6 +5780,30 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5761
5780
  this.formatString = null;
5762
5781
  }
5763
5782
  }
5783
+ checkInputFormats() {
5784
+ this.inputFormatsString = [];
5785
+ if (this.inputFormats) {
5786
+ for (const format of this.inputFormats) {
5787
+ let formatString = '';
5788
+ if (typeof format === 'string') {
5789
+ formatString = format;
5790
+ }
5791
+ else if (format.skeleton !== '' && !isNullOrUndefined(format.skeleton)) {
5792
+ const skeletonString = format.skeleton;
5793
+ formatString = this.globalize.getDatePattern({ skeleton: skeletonString, type: 'date' });
5794
+ }
5795
+ if (formatString) {
5796
+ this.inputFormatsString.push(formatString);
5797
+ }
5798
+ }
5799
+ if (this.inputFormatsString.length === 0) {
5800
+ this.inputFormatsString = null;
5801
+ }
5802
+ }
5803
+ else {
5804
+ this.inputFormatsString = null;
5805
+ }
5806
+ }
5764
5807
  initialize() {
5765
5808
  if (this.angularTag !== null) {
5766
5809
  this.validationAttribute(this.element, this.inputElement);
@@ -6389,7 +6432,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6389
6432
  if (range.length > 1) {
6390
6433
  this.invalidValueString = null;
6391
6434
  const dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6392
- const startDate = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), dateOptions);
6435
+ let startDate = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), dateOptions);
6393
6436
  let endDate = this.globalize.parseDate(this.getAmPmValue(range[1]).trim(), dateOptions);
6394
6437
  if (this.start !== 'Decade' && this.start === 'Year' && this.depth !== 'Month') {
6395
6438
  if (this.inputElement.defaultValue !== value) {
@@ -6399,6 +6442,23 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6399
6442
  endDate = this.max;
6400
6443
  }
6401
6444
  }
6445
+ if (((isNullOrUndefined(startDate) || (typeof (startDate) === 'object' && isNaN(startDate.getTime()))
6446
+ || isNullOrUndefined(endDate)) || (typeof (endDate) === 'object' && isNaN(endDate.getTime())))
6447
+ && !isNullOrUndefined(this.inputFormatsString)) {
6448
+ for (const format of this.inputFormatsString) {
6449
+ const inputFormatOptions = { format: format, type: 'date', skeleton: 'yMd' };
6450
+ if (isNullOrUndefined(startDate) || (typeof (startDate) === 'object' && isNaN(startDate.getTime()))) {
6451
+ startDate = this.globalize.parseDate(this.getAmPmValue(range[0]).trim(), inputFormatOptions);
6452
+ }
6453
+ if (isNullOrUndefined(endDate) || (typeof (endDate) === 'object' && isNaN(endDate.getTime()))) {
6454
+ endDate = this.globalize.parseDate(this.getAmPmValue(range[1]).trim(), inputFormatOptions);
6455
+ }
6456
+ if (!isNullOrUndefined(startDate) && startDate instanceof Date && !isNaN(startDate.getTime())
6457
+ && !isNullOrUndefined(endDate) && endDate instanceof Date && !isNaN(endDate.getTime())) {
6458
+ break;
6459
+ }
6460
+ }
6461
+ }
6402
6462
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
6403
6463
  const prevStartVal = this.startValue;
6404
6464
  this.startValue = startDate;
@@ -9814,6 +9874,9 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9814
9874
  this.updateInput();
9815
9875
  this.changeTrigger();
9816
9876
  break;
9877
+ case 'inputFormats':
9878
+ this.checkInputFormats();
9879
+ break;
9817
9880
  case 'locale':
9818
9881
  this.globalize = new Internationalization(this.locale);
9819
9882
  this.l10n.setLocale(this.locale);
@@ -10080,6 +10143,9 @@ __decorate$2([
10080
10143
  __decorate$2([
10081
10144
  Property(null)
10082
10145
  ], DateRangePicker.prototype, "format", void 0);
10146
+ __decorate$2([
10147
+ Property(null)
10148
+ ], DateRangePicker.prototype, "inputFormats", void 0);
10083
10149
  __decorate$2([
10084
10150
  Property(true)
10085
10151
  ], DateRangePicker.prototype, "enabled", void 0);