@syncfusion/ej2-schedule 20.2.36 → 20.2.38

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.
@@ -5966,8 +5966,9 @@ class EventBase {
5966
5966
  }
5967
5967
  }
5968
5968
  const occurrenceCollection = [];
5969
- for (const date of dates) {
5969
+ for (let date of dates) {
5970
5970
  const clonedObject = extend({}, event, null, true);
5971
+ date = this.getDSTAdjustedTime(date, clonedObject);
5971
5972
  clonedObject[this.parent.eventFields.startTime] = new Date(date);
5972
5973
  clonedObject[this.parent.eventFields.endTime] = new Date(new Date(date).setMilliseconds(duration));
5973
5974
  clonedObject[this.parent.eventFields.recurrenceID] = clonedObject[this.parent.eventFields.id];
@@ -5978,6 +5979,21 @@ class EventBase {
5978
5979
  }
5979
5980
  return occurrenceCollection;
5980
5981
  }
5982
+ getDSTAdjustedTime(date, event) {
5983
+ let occurDate = date;
5984
+ if (this.parent.timezone &&
5985
+ (event[this.parent.eventFields.startTimezone] || event[this.parent.eventFields.endTimezone])) {
5986
+ const eventOffset = this.getDSTDiff(event[this.parent.eventFields.startTime], new Date(date), event[this.parent.eventFields.startTimezone]);
5987
+ const schOffset = this.getDSTDiff(event[this.parent.eventFields.startTime], new Date(date), this.parent.timezone);
5988
+ occurDate = (new Date(date).getTime() - (eventOffset - schOffset) * 60000);
5989
+ }
5990
+ return occurDate;
5991
+ }
5992
+ getDSTDiff(startDate, occurDate, timezone) {
5993
+ const startOffset = this.parent.tzModule.offset(new Date(startDate), timezone);
5994
+ const occurOffset = this.parent.tzModule.offset(new Date(occurDate), timezone);
5995
+ return startOffset - occurOffset;
5996
+ }
5981
5997
  getParentEvent(eventObj, isParent = false) {
5982
5998
  let parentEvent;
5983
5999
  do {
@@ -11274,6 +11290,7 @@ class EventWindow {
11274
11290
  setDialogContent() {
11275
11291
  this.dialogObject.content = this.getEventWindowContent();
11276
11292
  this.dialogObject.dataBind();
11293
+ this.applyFormValidation();
11277
11294
  }
11278
11295
  preventEventSave(e) {
11279
11296
  if (this.parent && !this.parent.allowKeyboardInteraction && e.code === 'Enter') {
@@ -25144,7 +25161,7 @@ class ICalendarExport {
25144
25161
  const timeZone = this.parent.timezone || this.parent.tzModule.getLocalTimezoneName();
25145
25162
  const fields = this.parent.eventFields;
25146
25163
  eventsData.forEach((eventObj) => {
25147
- let uId = this.parent.eventBase.generateGuid();
25164
+ let uId = eventObj[fields.id] || eventObj.Guid || this.parent.eventBase.generateGuid();
25148
25165
  const editedExDate = [];
25149
25166
  if (eventObj[fields.recurrenceID]) {
25150
25167
  const filter = this.filterEvents(filterCollection, fields.id, eventObj[fields.recurrenceID]);
@@ -25343,8 +25360,16 @@ class ICalendarImport {
25343
25360
  break;
25344
25361
  case 'UID':
25345
25362
  curEvent[uId] = value;
25346
- curEvent[fields.id] = typeof (id) === 'string' ? id + count.toString() : id + count;
25347
- count++;
25363
+ if (typeof (id) == 'number') {
25364
+ curEvent[fields.id] = parseInt(value, 10);
25365
+ if (isNaN(curEvent[fields.id])) {
25366
+ curEvent[fields.id] = id + count;
25367
+ count++;
25368
+ }
25369
+ }
25370
+ else {
25371
+ curEvent[fields.id] = value;
25372
+ }
25348
25373
  break;
25349
25374
  case 'SUMMARY':
25350
25375
  curEvent[fields.subject] = value;
@@ -25380,6 +25405,10 @@ class ICalendarImport {
25380
25405
  const appoint = [];
25381
25406
  const uId = 'UID';
25382
25407
  const fields = this.parent.eventFields;
25408
+ let appointmentIds = [];
25409
+ this.parent.eventsData.forEach((eventObj) => {
25410
+ appointmentIds.push(eventObj[fields.id]);
25411
+ });
25383
25412
  app.forEach((eventObj) => {
25384
25413
  let parentObj;
25385
25414
  let id;
@@ -25388,24 +25417,26 @@ class ICalendarImport {
25388
25417
  parentObj = eventObj;
25389
25418
  id = eventObj[fields.id];
25390
25419
  }
25391
- const data = app.filter((data) => data.UID === eventObj[uId]);
25392
- if (data.length > 1 && isNullOrUndefined(eventObj[fields.recurrenceID])) {
25393
- for (let i = 0; i < data.length; i++) {
25394
- // eslint-disable-next-line no-prototype-builtins
25395
- if (data[i].hasOwnProperty(fields.recurrenceID)) {
25396
- const exdate = data[i][fields.recurrenceID];
25397
- data[i][fields.recurrenceID] = id;
25398
- data[i][fields.recurrenceException] = null;
25399
- parentObj[fields.recurrenceException] = (isNullOrUndefined(parentObj[fields.recurrenceException])) ?
25400
- exdate : parentObj[fields.recurrenceException] + ',' + exdate;
25401
- appoint.push(data[i]);
25420
+ if (appointmentIds.indexOf(eventObj[fields.id]) < 0) {
25421
+ const data = app.filter((data) => data.UID === eventObj[uId]);
25422
+ if (data.length > 1 && isNullOrUndefined(eventObj[fields.recurrenceID])) {
25423
+ for (let i = 0; i < data.length; i++) {
25424
+ // eslint-disable-next-line no-prototype-builtins
25425
+ if (data[i].hasOwnProperty(fields.recurrenceID)) {
25426
+ const exdate = data[i][fields.recurrenceID];
25427
+ data[i][fields.recurrenceID] = id;
25428
+ data[i][fields.recurrenceException] = null;
25429
+ parentObj[fields.recurrenceException] = (isNullOrUndefined(parentObj[fields.recurrenceException])) ?
25430
+ exdate : parentObj[fields.recurrenceException] + ',' + exdate;
25431
+ appoint.push(data[i]);
25432
+ }
25402
25433
  }
25434
+ appoint.push(parentObj);
25435
+ // eslint-disable-next-line no-prototype-builtins
25436
+ }
25437
+ else if (!eventObj.hasOwnProperty(fields.recurrenceID)) {
25438
+ appoint.push(eventObj);
25403
25439
  }
25404
- appoint.push(parentObj);
25405
- // eslint-disable-next-line no-prototype-builtins
25406
- }
25407
- else if (!eventObj.hasOwnProperty(fields.recurrenceID)) {
25408
- appoint.push(eventObj);
25409
25440
  }
25410
25441
  });
25411
25442
  return appoint;