@syncfusion/ej2-calendars 22.2.5 → 22.2.9

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.
@@ -4144,7 +4144,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4144
4144
  this.popupObj = new Popup(this.popupWrapper, {
4145
4145
  content: this.calendarElement,
4146
4146
  relateTo: Browser.isDevice ? document.body : this.inputWrapper.container,
4147
- position: Browser.isDevice ? { X: 'center', Y: 'center' } : { X: 'left', Y: 'bottom' },
4147
+ position: Browser.isDevice ? { X: 'center', Y: 'center' } : (this.enableRtl ? { X: 'right', Y: 'bottom' } : { X: 'left', Y: 'bottom' }),
4148
4148
  offsetY: OFFSETVALUE,
4149
4149
  targetType: 'container',
4150
4150
  enableRtl: this.enableRtl,
@@ -4462,7 +4462,6 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4462
4462
  addClass(_this.inputWrapper.buttons, ACTIVE);
4463
4463
  _this.preventArgs.appendTo.appendChild(_this.popupWrapper);
4464
4464
  _this.popupObj.refreshPosition(_this.inputElement);
4465
- var popupLeft = parseFloat(_this.popupWrapper.style.left) - (_this.popupWrapper.offsetWidth - _this.inputWrapper.container.offsetWidth);
4466
4465
  var openAnimation = {
4467
4466
  name: 'FadeIn',
4468
4467
  duration: Browser.isDevice ? 0 : OPENDURATION
@@ -4476,9 +4475,6 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4476
4475
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4477
4476
  _super.prototype.setOverlayIndex.call(_this, _this.mobilePopupWrapper, _this.popupObj.element, _this.modal, Browser.isDevice);
4478
4477
  _this.setAriaAttributes();
4479
- if (_this.enableRtl && popupLeft > 0) {
4480
- _this.popupWrapper.style.left = popupLeft + "px";
4481
- }
4482
4478
  }
4483
4479
  else {
4484
4480
  _this.popupObj.destroy();
@@ -5908,9 +5904,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5908
5904
  this.show(null, e);
5909
5905
  if (!this.isMobile) {
5910
5906
  if (!isNullOrUndefined(this.leftCalendar)) {
5911
- this.isRangeIconClicked = false;
5912
5907
  this.calendarFocus();
5913
- this.isRangeIconClicked = true;
5914
5908
  }
5915
5909
  }
5916
5910
  addClass([this.inputWrapper.container], [INPUTFOCUS$1]);
@@ -7081,16 +7075,11 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
7081
7075
  if (event) {
7082
7076
  leftCalendar = closest(event.target, '.' + LEFTCALENDER);
7083
7077
  }
7084
- if (!isNullOrUndefined(leftCalendar)) {
7085
- this.leftCalendar.children[1].firstElementChild.focus();
7078
+ if (event && isNullOrUndefined(leftCalendar)) {
7079
+ rightCalendar = event && closest(event.target, '.' + RIGHTCALENDER);
7086
7080
  }
7087
- else {
7088
- if (event) {
7089
- rightCalendar = event && closest(event.target, '.' + RIGHTCALENDER);
7090
- }
7091
- if (!isNullOrUndefined(rightCalendar)) {
7092
- this.rightCalendar.children[1].firstElementChild.focus();
7093
- }
7081
+ if (!isNullOrUndefined(leftCalendar) || !isNullOrUndefined(rightCalendar)) {
7082
+ this.inputWrapper.container.focus();
7094
7083
  }
7095
7084
  addClass([ele], SELECTED$3);
7096
7085
  this.calendarIconEvent();
@@ -8263,10 +8252,6 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8263
8252
  else {
8264
8253
  _this.inputElement.removeAttribute('aria-activedescendant');
8265
8254
  }
8266
- if (_this.enableRtl) {
8267
- var popupLeft = parseFloat(_this.popupWrapper.style.left) - (_this.popupWrapper.offsetWidth - _this.inputWrapper.container.offsetWidth);
8268
- _this.popupWrapper.style.left = popupLeft > 0 ? popupLeft + "px" : _this.popupWrapper.style.left;
8269
- }
8270
8255
  addClass([_this.inputWrapper.buttons[0]], ACTIVE$1);
8271
8256
  if (!_this.isMobile) {
8272
8257
  if (_this.cancelButton) {
@@ -10027,6 +10012,7 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10027
10012
  this.validateInterval();
10028
10013
  this.bindEvents();
10029
10014
  this.validateDisable();
10015
+ this.setTimeZone();
10030
10016
  this.setValue(this.getFormattedValue(this.value));
10031
10017
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
10032
10018
  this.updateInputValue(this.maskedDateValue);
@@ -10043,6 +10029,20 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10043
10029
  }
10044
10030
  this.renderComplete();
10045
10031
  };
10032
+ TimePicker.prototype.setTimeZone = function () {
10033
+ if (!isNullOrUndefined(this.serverTimezoneOffset) && this.value) {
10034
+ var clientTimeZoneDiff = new Date().getTimezoneOffset() / 60;
10035
+ var serverTimezoneDiff = this.serverTimezoneOffset;
10036
+ var timeZoneDiff = serverTimezoneDiff + clientTimeZoneDiff;
10037
+ timeZoneDiff = this.isDayLightSaving() ? timeZoneDiff-- : timeZoneDiff;
10038
+ this.value = new Date((this.value).getTime() + (timeZoneDiff * 60 * 60 * 1000));
10039
+ }
10040
+ };
10041
+ TimePicker.prototype.isDayLightSaving = function () {
10042
+ var firstOffset = new Date(this.value.getFullYear(), 0, 1).getTimezoneOffset();
10043
+ var secondOffset = new Date(this.value.getFullYear(), 6, 1).getTimezoneOffset();
10044
+ return (this.value.getTimezoneOffset() < Math.max(firstOffset, secondOffset));
10045
+ };
10046
10046
  TimePicker.prototype.setTimeAllowEdit = function () {
10047
10047
  if (this.allowEdit) {
10048
10048
  if (!this.readonly) {
@@ -12371,6 +12371,9 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
12371
12371
  __decorate$3([
12372
12372
  Property({ day: 'day', month: 'month', year: 'year', hour: 'hour', minute: 'minute', second: 'second', dayOfTheWeek: 'day of the week' })
12373
12373
  ], TimePicker.prototype, "maskPlaceholder", void 0);
12374
+ __decorate$3([
12375
+ Property(null)
12376
+ ], TimePicker.prototype, "serverTimezoneOffset", void 0);
12374
12377
  __decorate$3([
12375
12378
  Event()
12376
12379
  ], TimePicker.prototype, "change", void 0);