Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#IP-306] Handle Cosmos unix timestamp format #145

Merged
merged 4 commits into from
Jul 14, 2021

Conversation

AleDore
Copy link
Contributor

@AleDore AleDore commented Jul 9, 2021

List of Changes

  • update default value of optOutEmailSwitchDate
  • add specific tests

Motivation and Context

This solve a problem while comparing a Date made from a Unix Timestamp and another one made from Timestamp expressed in millisecond.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@pagopa-github-bot
Copy link
Contributor

Warnings
⚠️

Please include a Pivotal story at the beginning of the PR title (see below).

Example of PR titles that include pivotal stories:

  • single story: [#123456] my PR title
  • multiple stories: [#123456,#123457,#123458] my PR title

Generated by 🚫 dangerJS

@balanza balanza marked this pull request as draft July 13, 2021 13:48
@AleDore AleDore marked this pull request as ready for review July 13, 2021 15:48
Comment on lines 78 to 81
console.log(nowTimestamp);
console.log(aFutureOptOutEmailSwitchDate);
console.log(aPastOptOutEmailSwitchDate);
console.log(isBefore(nowTimestamp, aFutureOptOutEmailSwitchDate));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need these logs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope I'll remove it

const anOptOutEmailSwitchDate = UTCISODateFromString.decode(
"2021-07-08T23:59:59Z"
).getOrElseL(() => fail("wrong date value"));
const nowTimestamp = Math.floor(new Date().getTime() / 1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const nowTimestamp = Math.floor(new Date().getTime() / 1000);
const lastUpdateTimestamp = Math.floor(new Date().getTime() / 1000);

@AleDore AleDore requested review from BurnedMarshal and balanza July 13, 2021 16:08
Copy link
Contributor

@BurnedMarshal BurnedMarshal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AleDore AleDore merged commit 7a8efce into master Jul 14, 2021
@AleDore AleDore deleted the IP-306_handle_cosmos_unix_timestamp branch July 14, 2021 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants