@syncfusion/ej2-calendars 22.2.5 → 22.2.8

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.
@@ -4099,7 +4099,7 @@ let DatePicker = class DatePicker extends Calendar {
4099
4099
  this.popupObj = new Popup(this.popupWrapper, {
4100
4100
  content: this.calendarElement,
4101
4101
  relateTo: Browser.isDevice ? document.body : this.inputWrapper.container,
4102
- position: Browser.isDevice ? { X: 'center', Y: 'center' } : { X: 'left', Y: 'bottom' },
4102
+ position: Browser.isDevice ? { X: 'center', Y: 'center' } : (this.enableRtl ? { X: 'right', Y: 'bottom' } : { X: 'left', Y: 'bottom' }),
4103
4103
  offsetY: OFFSETVALUE,
4104
4104
  targetType: 'container',
4105
4105
  enableRtl: this.enableRtl,
@@ -4416,7 +4416,6 @@ let DatePicker = class DatePicker extends Calendar {
4416
4416
  addClass(this.inputWrapper.buttons, ACTIVE);
4417
4417
  this.preventArgs.appendTo.appendChild(this.popupWrapper);
4418
4418
  this.popupObj.refreshPosition(this.inputElement);
4419
- const popupLeft = parseFloat(this.popupWrapper.style.left) - (this.popupWrapper.offsetWidth - this.inputWrapper.container.offsetWidth);
4420
4419
  const openAnimation = {
4421
4420
  name: 'FadeIn',
4422
4421
  duration: Browser.isDevice ? 0 : OPENDURATION
@@ -4430,9 +4429,6 @@ let DatePicker = class DatePicker extends Calendar {
4430
4429
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4431
4430
  super.setOverlayIndex(this.mobilePopupWrapper, this.popupObj.element, this.modal, Browser.isDevice);
4432
4431
  this.setAriaAttributes();
4433
- if (this.enableRtl && popupLeft > 0) {
4434
- this.popupWrapper.style.left = popupLeft + "px";
4435
- }
4436
4432
  }
4437
4433
  else {
4438
4434
  this.popupObj.destroy();
@@ -8169,10 +8165,6 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8169
8165
  else {
8170
8166
  this.inputElement.removeAttribute('aria-activedescendant');
8171
8167
  }
8172
- if (this.enableRtl) {
8173
- const popupLeft = parseFloat(this.popupWrapper.style.left) - (this.popupWrapper.offsetWidth - this.inputWrapper.container.offsetWidth);
8174
- this.popupWrapper.style.left = popupLeft > 0 ? popupLeft + "px" : this.popupWrapper.style.left;
8175
- }
8176
8168
  addClass([this.inputWrapper.buttons[0]], ACTIVE$1);
8177
8169
  if (!this.isMobile) {
8178
8170
  if (this.cancelButton) {
@@ -9909,6 +9901,7 @@ let TimePicker = class TimePicker extends Component {
9909
9901
  this.validateInterval();
9910
9902
  this.bindEvents();
9911
9903
  this.validateDisable();
9904
+ this.setTimeZone();
9912
9905
  this.setValue(this.getFormattedValue(this.value));
9913
9906
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
9914
9907
  this.updateInputValue(this.maskedDateValue);
@@ -9925,6 +9918,20 @@ let TimePicker = class TimePicker extends Component {
9925
9918
  }
9926
9919
  this.renderComplete();
9927
9920
  }
9921
+ setTimeZone() {
9922
+ if (!isNullOrUndefined(this.serverTimezoneOffset) && this.value) {
9923
+ const clientTimeZoneDiff = new Date().getTimezoneOffset() / 60;
9924
+ const serverTimezoneDiff = this.serverTimezoneOffset;
9925
+ let timeZoneDiff = serverTimezoneDiff + clientTimeZoneDiff;
9926
+ timeZoneDiff = this.isDayLightSaving() ? timeZoneDiff-- : timeZoneDiff;
9927
+ this.value = new Date((this.value).getTime() + (timeZoneDiff * 60 * 60 * 1000));
9928
+ }
9929
+ }
9930
+ isDayLightSaving() {
9931
+ const firstOffset = new Date(this.value.getFullYear(), 0, 1).getTimezoneOffset();
9932
+ const secondOffset = new Date(this.value.getFullYear(), 6, 1).getTimezoneOffset();
9933
+ return (this.value.getTimezoneOffset() < Math.max(firstOffset, secondOffset));
9934
+ }
9928
9935
  setTimeAllowEdit() {
9929
9936
  if (this.allowEdit) {
9930
9937
  if (!this.readonly) {
@@ -12246,6 +12253,9 @@ __decorate$3([
12246
12253
  __decorate$3([
12247
12254
  Property({ day: 'day', month: 'month', year: 'year', hour: 'hour', minute: 'minute', second: 'second', dayOfTheWeek: 'day of the week' })
12248
12255
  ], TimePicker.prototype, "maskPlaceholder", void 0);
12256
+ __decorate$3([
12257
+ Property(null)
12258
+ ], TimePicker.prototype, "serverTimezoneOffset", void 0);
12249
12259
  __decorate$3([
12250
12260
  Event()
12251
12261
  ], TimePicker.prototype, "change", void 0);