@syncfusion/ej2-calendars 22.1.38 → 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.
@@ -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();
@@ -8263,10 +8259,6 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8263
8259
  else {
8264
8260
  _this.inputElement.removeAttribute('aria-activedescendant');
8265
8261
  }
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
8262
  addClass([_this.inputWrapper.buttons[0]], ACTIVE$1);
8271
8263
  if (!_this.isMobile) {
8272
8264
  if (_this.cancelButton) {
@@ -10027,6 +10019,7 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10027
10019
  this.validateInterval();
10028
10020
  this.bindEvents();
10029
10021
  this.validateDisable();
10022
+ this.setTimeZone();
10030
10023
  this.setValue(this.getFormattedValue(this.value));
10031
10024
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
10032
10025
  this.updateInputValue(this.maskedDateValue);
@@ -10043,6 +10036,20 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10043
10036
  }
10044
10037
  this.renderComplete();
10045
10038
  };
10039
+ TimePicker.prototype.setTimeZone = function () {
10040
+ if (!isNullOrUndefined(this.serverTimezoneOffset) && this.value) {
10041
+ var clientTimeZoneDiff = new Date().getTimezoneOffset() / 60;
10042
+ var serverTimezoneDiff = this.serverTimezoneOffset;
10043
+ var timeZoneDiff = serverTimezoneDiff + clientTimeZoneDiff;
10044
+ timeZoneDiff = this.isDayLightSaving() ? timeZoneDiff-- : timeZoneDiff;
10045
+ this.value = new Date((this.value).getTime() + (timeZoneDiff * 60 * 60 * 1000));
10046
+ }
10047
+ };
10048
+ TimePicker.prototype.isDayLightSaving = function () {
10049
+ var firstOffset = new Date(this.value.getFullYear(), 0, 1).getTimezoneOffset();
10050
+ var secondOffset = new Date(this.value.getFullYear(), 6, 1).getTimezoneOffset();
10051
+ return (this.value.getTimezoneOffset() < Math.max(firstOffset, secondOffset));
10052
+ };
10046
10053
  TimePicker.prototype.setTimeAllowEdit = function () {
10047
10054
  if (this.allowEdit) {
10048
10055
  if (!this.readonly) {
@@ -12371,6 +12378,9 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
12371
12378
  __decorate$3([
12372
12379
  Property({ day: 'day', month: 'month', year: 'year', hour: 'hour', minute: 'minute', second: 'second', dayOfTheWeek: 'day of the week' })
12373
12380
  ], TimePicker.prototype, "maskPlaceholder", void 0);
12381
+ __decorate$3([
12382
+ Property(null)
12383
+ ], TimePicker.prototype, "serverTimezoneOffset", void 0);
12374
12384
  __decorate$3([
12375
12385
  Event()
12376
12386
  ], TimePicker.prototype, "change", void 0);