@syncfusion/ej2-calendars 34.1.29 → 34.2.3

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.
@@ -1816,7 +1816,9 @@ let CalendarBase = class CalendarBase extends Component {
1816
1816
  tableBodyElement = this.tableBodyElement;
1817
1817
  }
1818
1818
  if (!multiSelection && !isNullOrUndefined(tableBodyElement.querySelector('.' + SELECTED))) {
1819
- removeClass([tableBodyElement.querySelector('.' + SELECTED)], SELECTED);
1819
+ const prevSelected = tableBodyElement.querySelector('.' + SELECTED);
1820
+ removeClass([prevSelected], SELECTED);
1821
+ prevSelected.setAttribute('aria-selected', 'false');
1820
1822
  }
1821
1823
  if (!multiSelection && !isNullOrUndefined(tableBodyElement.querySelector('.' + FOCUSEDDATE))) {
1822
1824
  removeClass([tableBodyElement.querySelector('.' + FOCUSEDDATE)], FOCUSEDDATE);
@@ -1836,10 +1838,12 @@ let CalendarBase = class CalendarBase extends Component {
1836
1838
  if (collection[index] === selectedElement &&
1837
1839
  !this.checkPresentDate(new Date(parseInt(selectedElement.getAttribute('id').split('_')[0], 10)), values)) {
1838
1840
  removeClass([collection[index]], SELECTED);
1841
+ collection[index].setAttribute('aria-selected', 'false');
1839
1842
  }
1840
1843
  }
1841
1844
  if (element.classList.contains(SELECTED)) {
1842
1845
  removeClass([element], SELECTED);
1846
+ element.setAttribute('aria-selected', 'false');
1843
1847
  for (let i = 0; i < copyValues.length; i++) {
1844
1848
  const type = (this.calendarMode === 'Gregorian') ? 'gregorian' : 'islamic';
1845
1849
  const formatOptions = { format: null, type: 'date', skeleton: 'short', calendar: type };
@@ -1849,12 +1853,14 @@ let CalendarBase = class CalendarBase extends Component {
1849
1853
  const index = copyValues.indexOf(copyValues[i]);
1850
1854
  copyValues.splice(index, 1);
1851
1855
  addClass([element], FOCUSEDDATE);
1856
+ element.setAttribute('aria-selected', 'true');
1852
1857
  }
1853
1858
  }
1854
1859
  this.setProperties({ values: copyValues }, true);
1855
1860
  }
1856
1861
  else {
1857
1862
  addClass([element], SELECTED);
1863
+ element.setAttribute('aria-selected', 'true');
1858
1864
  }
1859
1865
  }
1860
1866
  else {
@@ -1952,10 +1958,22 @@ let CalendarBase = class CalendarBase extends Component {
1952
1958
  }
1953
1959
  isMonthYearRange(date) {
1954
1960
  if (this.calendarMode === 'Gregorian') {
1955
- return date.getMonth() >= this.min.getMonth()
1956
- && date.getFullYear() >= this.min.getFullYear()
1957
- && date.getMonth() <= this.max.getMonth()
1958
- && date.getFullYear() <= this.max.getFullYear();
1961
+ const dateYear = date.getFullYear();
1962
+ const dateMonth = date.getMonth();
1963
+ const minYear = this.min.getFullYear();
1964
+ const minMonth = this.min.getMonth();
1965
+ const maxYear = this.max.getFullYear();
1966
+ const maxMonth = this.max.getMonth();
1967
+ if (dateYear < minYear || dateYear > maxYear) {
1968
+ return false;
1969
+ }
1970
+ if (dateYear === minYear && dateMonth < minMonth) {
1971
+ return false;
1972
+ }
1973
+ if (dateYear === maxYear && dateMonth > maxMonth) {
1974
+ return false;
1975
+ }
1976
+ return true;
1959
1977
  }
1960
1978
  else {
1961
1979
  const islamicDate = this.islamicModule.getIslamicDate(date);
@@ -5918,6 +5936,29 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5918
5936
  this.inputFormatsString = null;
5919
5937
  }
5920
5938
  }
5939
+ setTimeZone() {
5940
+ if (!isNullOrUndefined(this.serverTimezoneOffset)) {
5941
+ if (this.startValue) {
5942
+ const clientTimeZoneDiff = new Date().getTimezoneOffset() / 60;
5943
+ const serverTimezoneDiff = this.serverTimezoneOffset;
5944
+ let timeZoneDiff = serverTimezoneDiff + clientTimeZoneDiff;
5945
+ timeZoneDiff = this.isDayLightSaving(this.startValue) ? timeZoneDiff-- : timeZoneDiff;
5946
+ this.startValue = new Date((this.startValue).getTime() + (timeZoneDiff * 60 * 60 * 1000));
5947
+ }
5948
+ if (this.endValue) {
5949
+ const clientTimeZoneDiff = new Date().getTimezoneOffset() / 60;
5950
+ const serverTimezoneDiff = this.serverTimezoneOffset;
5951
+ let timeZoneDiff = serverTimezoneDiff + clientTimeZoneDiff;
5952
+ timeZoneDiff = this.isDayLightSaving(this.endValue) ? timeZoneDiff-- : timeZoneDiff;
5953
+ this.endValue = new Date((this.endValue).getTime() + (timeZoneDiff * 60 * 60 * 1000));
5954
+ }
5955
+ }
5956
+ }
5957
+ isDayLightSaving(date) {
5958
+ const firstOffset = new Date(date.getFullYear(), 0, 1).getTimezoneOffset();
5959
+ const secondOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
5960
+ return (date.getTimezoneOffset() < Math.max(firstOffset, secondOffset));
5961
+ }
5921
5962
  initialize() {
5922
5963
  if (this.angularTag !== null) {
5923
5964
  this.validationAttribute(this.element, this.inputElement);
@@ -5927,6 +5968,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5927
5968
  const start = this.checkDateValue(new Date(this.checkValue(this.startValue)));
5928
5969
  this.setProperties({ startDate: start }, true); // persist the value propeerty.
5929
5970
  this.setProperties({ endValue: this.checkDateValue(new Date(this.checkValue(this.endValue))) }, true);
5971
+ this.setTimeZone();
5930
5972
  this.setValue();
5931
5973
  this.setProperties({ min: this.checkDateValue(new Date(this.checkValue(this.min))) }, true);
5932
5974
  this.setProperties({ max: this.checkDateValue(new Date(this.checkValue(this.max))) }, true);