From 016678a143c8e43abb68ebfaa1962fd7e58895bf Mon Sep 17 00:00:00 2001 From: Thomas Lay Date: Wed, 12 Jan 2022 11:25:16 +0100 Subject: [PATCH 1/3] Set created and lastUpdated dates to a day-level UTC timestamp when the TC string is updated --- modules/core/src/TCModel.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/core/src/TCModel.ts b/modules/core/src/TCModel.ts index 1b91808f..894899c9 100644 --- a/modules/core/src/TCModel.ts +++ b/modules/core/src/TCModel.ts @@ -140,7 +140,6 @@ export class TCModel extends Cloneable { } - this.created = new Date(); this.updated(); } @@ -691,13 +690,17 @@ export class TCModel extends Cloneable { } /** - * updated - updates the lastUpdatedDate with a 'now' timestamp + * updated - updates the created and lastUpdated dates with a 'now' day-level UTC timestamp * * @return {void} */ public updated(): void { - this.lastUpdated = new Date(); + const date = new Date(); + const utcDate = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())); + + this.created = utcDate; + this.lastUpdated = utcDate; } From 70a2e594c346f6b80696445071532e5cb9e773bb Mon Sep 17 00:00:00 2001 From: Thomas Lay Date: Wed, 12 Jan 2022 12:52:17 +0100 Subject: [PATCH 2/3] Update doc for cli tool --- modules/cli/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/cli/README.md b/modules/cli/README.md index 2d879bb2..5fd3d851 100644 --- a/modules/cli/README.md +++ b/modules/cli/README.md @@ -28,8 +28,8 @@ cmpId: 2 cmpVersion: 1 consentScreen: 2 consentLanguage: "EN" -created: Mon Dec 09 2019 18:01:46 GMT-0800 (Pacific Standard Time) -lastUpdated: Mon Dec 09 2019 18:01:46 GMT-0800 (Pacific Standard Time) +created: Mon Dec 09 2019 00:00:00 GMT +lastUpdated: Mon Dec 09 2019 00:00:00 GMT policyVersion: 2 isServiceSpecific: false useNonStandardStacks: false From 9a36ffa8262abf51937def356886908540680cab Mon Sep 17 00:00:00 2001 From: Thomas Lay Date: Wed, 12 Jan 2022 12:53:15 +0100 Subject: [PATCH 3/3] Update created and lastUpdated dates for testing tool --- modules/testing/src/TCModelFactory.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/testing/src/TCModelFactory.ts b/modules/testing/src/TCModelFactory.ts index 2919a16c..3c9c8883 100644 --- a/modules/testing/src/TCModelFactory.ts +++ b/modules/testing/src/TCModelFactory.ts @@ -38,11 +38,13 @@ export class TCModelFactory { tcModel.publisherCountryCode = String.fromCharCode(makeRandomInt(65, 90)) + String.fromCharCode(makeRandomInt(65, 90)); - const now = (new Date()).getTime(); + const date = new Date(); + const utcDate = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())); + const now = utcDate.getTime(); const GDPRMageddon = 1576883249; tcModel.created = new Date(makeRandomInt(GDPRMageddon, now)); - tcModel.lastUpdated = new Date(makeRandomInt(tcModel.created.getTime(), now)); + tcModel.lastUpdated = new Date(makeRandomInt(GDPRMageddon, now)); const mapping = { 'purposes': [