Skip to content

Commit

Permalink
Merge pull request #316 from tla-sirdata/master
Browse files Browse the repository at this point in the history
Reduce timestamp granularity in TC String
  • Loading branch information
kenario authored Jan 14, 2022
2 parents 257c71c + 9a36ffa commit 7c953a1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions modules/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions modules/core/src/TCModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ export class TCModel extends Cloneable<TCModel> {

}

this.created = new Date();
this.updated();

}
Expand Down Expand Up @@ -691,13 +690,17 @@ export class TCModel extends Cloneable<TCModel> {
}

/**
* 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;

}

Expand Down
6 changes: 4 additions & 2 deletions modules/testing/src/TCModelFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': [
Expand Down

0 comments on commit 7c953a1

Please sign in to comment.