@syncfusion/ej2-calendars 34.1.29 → 34.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.
@@ -1952,10 +1952,22 @@ let CalendarBase = class CalendarBase extends Component {
1952
1952
  }
1953
1953
  isMonthYearRange(date) {
1954
1954
  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();
1955
+ const dateYear = date.getFullYear();
1956
+ const dateMonth = date.getMonth();
1957
+ const minYear = this.min.getFullYear();
1958
+ const minMonth = this.min.getMonth();
1959
+ const maxYear = this.max.getFullYear();
1960
+ const maxMonth = this.max.getMonth();
1961
+ if (dateYear < minYear || dateYear > maxYear) {
1962
+ return false;
1963
+ }
1964
+ if (dateYear === minYear && dateMonth < minMonth) {
1965
+ return false;
1966
+ }
1967
+ if (dateYear === maxYear && dateMonth > maxMonth) {
1968
+ return false;
1969
+ }
1970
+ return true;
1959
1971
  }
1960
1972
  else {
1961
1973
  const islamicDate = this.islamicModule.getIslamicDate(date);
@@ -5918,6 +5930,29 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5918
5930
  this.inputFormatsString = null;
5919
5931
  }
5920
5932
  }
5933
+ setTimeZone() {
5934
+ if (!isNullOrUndefined(this.serverTimezoneOffset)) {
5935
+ if (this.startValue) {
5936
+ const clientTimeZoneDiff = new Date().getTimezoneOffset() / 60;
5937
+ const serverTimezoneDiff = this.serverTimezoneOffset;
5938
+ let timeZoneDiff = serverTimezoneDiff + clientTimeZoneDiff;
5939
+ timeZoneDiff = this.isDayLightSaving(this.startValue) ? timeZoneDiff-- : timeZoneDiff;
5940
+ this.startValue = new Date((this.startValue).getTime() + (timeZoneDiff * 60 * 60 * 1000));
5941
+ }
5942
+ if (this.endValue) {
5943
+ const clientTimeZoneDiff = new Date().getTimezoneOffset() / 60;
5944
+ const serverTimezoneDiff = this.serverTimezoneOffset;
5945
+ let timeZoneDiff = serverTimezoneDiff + clientTimeZoneDiff;
5946
+ timeZoneDiff = this.isDayLightSaving(this.endValue) ? timeZoneDiff-- : timeZoneDiff;
5947
+ this.endValue = new Date((this.endValue).getTime() + (timeZoneDiff * 60 * 60 * 1000));
5948
+ }
5949
+ }
5950
+ }
5951
+ isDayLightSaving(date) {
5952
+ const firstOffset = new Date(date.getFullYear(), 0, 1).getTimezoneOffset();
5953
+ const secondOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
5954
+ return (date.getTimezoneOffset() < Math.max(firstOffset, secondOffset));
5955
+ }
5921
5956
  initialize() {
5922
5957
  if (this.angularTag !== null) {
5923
5958
  this.validationAttribute(this.element, this.inputElement);
@@ -5927,6 +5962,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5927
5962
  const start = this.checkDateValue(new Date(this.checkValue(this.startValue)));
5928
5963
  this.setProperties({ startDate: start }, true); // persist the value propeerty.
5929
5964
  this.setProperties({ endValue: this.checkDateValue(new Date(this.checkValue(this.endValue))) }, true);
5965
+ this.setTimeZone();
5930
5966
  this.setValue();
5931
5967
  this.setProperties({ min: this.checkDateValue(new Date(this.checkValue(this.min))) }, true);
5932
5968
  this.setProperties({ max: this.checkDateValue(new Date(this.checkValue(this.max))) }, true);