sf-i-events 1.0.839 → 1.0.840

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.
package/dev/index.html CHANGED
@@ -734,7 +734,7 @@
734
734
  </div>
735
735
 
736
736
  </sf-i-events> -->
737
- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition" apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat" apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws" fill="solid" username="Viewer J1" userprofileid="344c84d2-5976-47ff-949b-49f6fa9627eb" projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" countryid="07d73b44-648d-4301-82c4-d6df43397824" myrole="viewer" showregisterexport="false" features="[&quot;notices&quot;]" eventfielddependencies="[{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;country&quot;, &quot;child&quot;: &quot;state&quot;},{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;category&quot;, &quot;child&quot;: &quot;subcategory&quot;},{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;frequency&quot;, &quot;child&quot;: &quot;subfrequency&quot;}]" eventfields="[{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/riskarea&quot;, &quot;field&quot;: &quot;riskarea&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/jurisdiction&quot;, &quot;field&quot;: &quot;jurisdiction&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/updatetype&quot;, &quot;field&quot;: &quot;updatetype&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/country&quot;, &quot;field&quot;: &quot;country&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/specificity&quot;, &quot;field&quot;: &quot;specificity&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/risk&quot;, &quot;field&quot;: &quot;risk&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/frequency&quot;, &quot;field&quot;: &quot;frequency&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/category&quot;, &quot;field&quot;: &quot;category&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/obligationtype&quot;, &quot;field&quot;: &quot;obligationtype&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/state&quot;, &quot;field&quot;: &quot;state&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/subfrequency&quot;, &quot;field&quot;: &quot;subfrequency&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/subcategory&quot;, &quot;field&quot;: &quot;subcategory&quot;},{&quot;type&quot;: &quot;sf-i-form&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/statute&quot;, &quot;field&quot;: &quot;statute&quot;, &quot;projectField&quot;: &quot;name&quot;}]" eventpreviewfields="[&quot;obligation&quot;]" eventhidefields="[&quot;comments&quot;,&quot;documents&quot;,&quot;lastupdated&quot;,&quot;approved&quot;,&quot;tags&quot;]" calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="2024">
737
+ <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer" apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition" apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat" apiidnotices="gghnbi7hku2qj5twrea6xxcaya0aqeis.lambda-url.us-east-1.on.aws" fill="solid" username="Viewer J1" userprofileid="344c84d2-5976-47ff-949b-49f6fa9627eb" projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" countryid="07d73b44-648d-4301-82c4-d6df43397824" myrole="viewer" showregisterexport="false" features="[&quot;notices&quot;]" eventfielddependencies="[{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;country&quot;, &quot;child&quot;: &quot;state&quot;},{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;category&quot;, &quot;child&quot;: &quot;subcategory&quot;},{&quot;type&quot;: &quot;foreignkey&quot;, &quot;parent&quot;: &quot;frequency&quot;, &quot;child&quot;: &quot;subfrequency&quot;}]" eventfields="[{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/riskarea&quot;, &quot;field&quot;: &quot;riskarea&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/jurisdiction&quot;, &quot;field&quot;: &quot;jurisdiction&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/updatetype&quot;, &quot;field&quot;: &quot;updatetype&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/country&quot;, &quot;field&quot;: &quot;country&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/specificity&quot;, &quot;field&quot;: &quot;specificity&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/risk&quot;, &quot;field&quot;: &quot;risk&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/frequency&quot;, &quot;field&quot;: &quot;frequency&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/category&quot;, &quot;field&quot;: &quot;category&quot;},{&quot;type&quot;: &quot;sf-i-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/obligationtype&quot;, &quot;field&quot;: &quot;obligationtype&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/state&quot;, &quot;field&quot;: &quot;state&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/subfrequency&quot;, &quot;field&quot;: &quot;subfrequency&quot;},{&quot;type&quot;: &quot;sf-i-sub-select&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/subcategory&quot;, &quot;field&quot;: &quot;subcategory&quot;},{&quot;type&quot;: &quot;sf-i-form&quot;, &quot;apiId&quot;: &quot;dnytrdlrmxgsy.cloudfront.net/statute&quot;, &quot;field&quot;: &quot;statute&quot;, &quot;projectField&quot;: &quot;name&quot;}]" eventpreviewfields="[&quot;obligation&quot;]" eventhidefields="[&quot;comments&quot;,&quot;documents&quot;,&quot;lastupdated&quot;,&quot;approved&quot;,&quot;tags&quot;]" calendarstartdd="01" calendarstartmm="04" calendarstartyyyy="2025">
738
738
 
739
739
  <div slot="uploader">
740
740
  <sf-i-uploader id="uploader" max="10" apiid="1peg5170d3" allowedextensions="[&quot;jpg&quot;,&quot;png&quot;,&quot;pdf&quot;,&quot;xls&quot;,&quot;xlsx&quot;,&quot;doc&quot;,&quot;docx&quot;]" extract="yes" projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" maxsize="5242880" allowdownload="yes"></sf-i-uploader>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sf-i-events",
3
3
  "private": false,
4
- "version": "1.0.839",
4
+ "version": "1.0.840",
5
5
  "description": "Superflows Navigation Component",
6
6
  "main": "sf-i-events.js",
7
7
  "module": "sf-i-events.js",
package/sf-i-events.d.ts CHANGED
@@ -504,6 +504,7 @@ export declare class SfIEvents extends LitElement {
504
504
  attachHandlers: (eventContainer: HTMLDivElement, valueStart: string, valueEnd: string) => void;
505
505
  processFindSelection: (eventContainer: HTMLDivElement, searchString: string) => Promise<void>;
506
506
  processDateSelection: (eventContainer: HTMLDivElement, fetchData?: boolean, showBackgroundButton?: boolean) => Promise<void>;
507
+ isLessThanYearApart: (date1: string | Date, date2: string | Date) => boolean;
507
508
  processDateSelectionViewer: (eventContainer: HTMLDivElement) => Promise<void>;
508
509
  initFindRightCol: () => void;
509
510
  initCustomRightCol: () => void;
package/sf-i-events.js CHANGED
@@ -5283,7 +5283,7 @@ let SfIEvents = class SfIEvents extends LitElement {
5283
5283
  this._SfStreamEventStatus.innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
5284
5284
  return;
5285
5285
  }
5286
- if ((new Date(valueEnd).getTime() - new Date(valueStart).getTime()) / (1000 * 60 * 60 * 24) > 365) {
5286
+ if (!this.isLessThanYearApart(valueEnd, valueStart)) {
5287
5287
  this._SfStreamEventStatus.innerHTML = "Chosen time window cannot be greater than 365 days";
5288
5288
  return;
5289
5289
  }
@@ -5312,6 +5312,23 @@ let SfIEvents = class SfIEvents extends LitElement {
5312
5312
  this.renderCompletenessGraph(eventContainer);
5313
5313
  }
5314
5314
  };
5315
+ this.isLessThanYearApart = (date1, date2) => {
5316
+ let d1 = new Date(date1);
5317
+ let d2 = new Date(date2);
5318
+ // Ensure d1 is always the earlier date
5319
+ if (d1 > d2) {
5320
+ [d1, d2] = [d2, d1];
5321
+ }
5322
+ // Check if the dates are exactly one year apart (same month & day)
5323
+ if (d2.getFullYear() - d1.getFullYear() === 1 && d2.getMonth() === d1.getMonth() && d2.getDate() === d1.getDate()) {
5324
+ return false;
5325
+ }
5326
+ // Calculate difference in milliseconds
5327
+ const diffInMs = d2.getTime() - d1.getTime();
5328
+ // One full year in milliseconds, considering leap years
5329
+ const oneYearInMs = 365.25 * 24 * 60 * 60 * 1000;
5330
+ return diffInMs < oneYearInMs;
5331
+ };
5315
5332
  this.processDateSelectionViewer = async (eventContainer) => {
5316
5333
  // var startDateCalendar = new Date(this.calendarStartMM + '/' + this.calendarStartDD + '/' + this.calendarStartYYYY);
5317
5334
  // var endDateCalendar = new Date(this.calendarStartMM + '/' + this.calendarStartDD + '/' + (parseInt(this.calendarStartYYYY) + 1));
@@ -5396,7 +5413,8 @@ let SfIEvents = class SfIEvents extends LitElement {
5396
5413
  this._SfStreamEventStatus.innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
5397
5414
  return;
5398
5415
  }
5399
- if ((new Date(valueEnd).getTime() - new Date(valueStart).getTime()) / (1000 * 60 * 60 * 24) > 365) {
5416
+ if (!this.isLessThanYearApart(valueEnd, valueStart)) {
5417
+ console.log('dates entered', valueEnd, valueStart);
5400
5418
  this._SfStreamEventStatus.innerHTML = "Chosen time window cannot be greater than 365 days";
5401
5419
  return;
5402
5420
  }
@@ -7916,7 +7916,7 @@ export class SfIEvents extends LitElement {
7916
7916
  (this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
7917
7917
  return;
7918
7918
  }
7919
- if((new Date(valueEnd).getTime() - new Date(valueStart).getTime())/(1000*60*60*24) > 365) {
7919
+ if(!this.isLessThanYearApart(valueEnd, valueStart)) {
7920
7920
  (this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen time window cannot be greater than 365 days";
7921
7921
  return;
7922
7922
  }
@@ -7948,6 +7948,28 @@ export class SfIEvents extends LitElement {
7948
7948
 
7949
7949
  }
7950
7950
 
7951
+ isLessThanYearApart = (date1: string | Date, date2: string | Date) => {
7952
+ let d1: Date = new Date(date1);
7953
+ let d2: Date = new Date(date2);
7954
+
7955
+ // Ensure d1 is always the earlier date
7956
+ if (d1 > d2) {
7957
+ [d1, d2] = [d2, d1];
7958
+ }
7959
+
7960
+ // Check if the dates are exactly one year apart (same month & day)
7961
+ if (d2.getFullYear() - d1.getFullYear() === 1 && d2.getMonth() === d1.getMonth() && d2.getDate() === d1.getDate()) {
7962
+ return false;
7963
+ }
7964
+
7965
+ // Calculate difference in milliseconds
7966
+ const diffInMs = d2.getTime() - d1.getTime();
7967
+
7968
+ // One full year in milliseconds, considering leap years
7969
+ const oneYearInMs = 365.25 * 24 * 60 * 60 * 1000;
7970
+
7971
+ return diffInMs < oneYearInMs;
7972
+ }
7951
7973
  processDateSelectionViewer = async (eventContainer: HTMLDivElement) => {
7952
7974
 
7953
7975
  // var startDateCalendar = new Date(this.calendarStartMM + '/' + this.calendarStartDD + '/' + this.calendarStartYYYY);
@@ -8034,7 +8056,8 @@ export class SfIEvents extends LitElement {
8034
8056
  (this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen End Date cannot be earlier than chosen Start Date";
8035
8057
  return;
8036
8058
  }
8037
- if((new Date(valueEnd).getTime() - new Date(valueStart).getTime())/(1000*60*60*24) > 365) {
8059
+ if(!this.isLessThanYearApart(valueEnd, valueStart)) {
8060
+ console.log('dates entered', valueEnd, valueStart);
8038
8061
  (this._SfStreamEventStatus as HTMLDivElement).innerHTML = "Chosen time window cannot be greater than 365 days";
8039
8062
  return;
8040
8063
  }