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

thirtyDayPeriodsSinceEpoch fix #276

Closed
wants to merge 2 commits into from
Closed

thirtyDayPeriodsSinceEpoch fix #276

wants to merge 2 commits into from

Conversation

nplasterer
Copy link
Contributor

In JS they do this

const thirtyDayPeriodsSinceEpoch = Math.floor(
          Date.now() / 1000 / 60 / 60 / 24 / 30
        )

I think this brings the code closer inline with that.

@nplasterer nplasterer self-assigned this Mar 6, 2024
@nplasterer nplasterer requested a review from a team as a code owner March 6, 2024 13:45
Comment on lines +590 to +591
let daysSinceEpoch = Date().timeIntervalSince1970 / (60 * 60 * 24)
let thirtyDayPeriodsSinceEpoch = Int(floor(daysSinceEpoch / 30))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

JS divides also by 1000 every where but I think that might be a bug in JS @rygine

@nplasterer
Copy link
Contributor Author

Confirmed that iOS convert to int takes the floor so I actually don't think we need this.

@nplasterer nplasterer closed this Mar 6, 2024
@nplasterer nplasterer deleted the np/fix-date-time branch March 6, 2024 16:54
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.

2 participants