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

Multiply seconds timestamp from chain by 1000 to convert to milliseconds #18

Merged
merged 5 commits into from
Nov 2, 2024

Conversation

glitch003
Copy link
Contributor

@glitch003 glitch003 commented Nov 2, 2024

This PR multiplies the timestamp from chain by 1000 to convert it to milliseconds, since that's what the JS date constructor needs.

I discovered this by adding additional logs (since removed, but was in this commit 830bc2c) and you can see the result from a run below. The tokenExpiresDate is wrong because it expects timestamps in milliseconds, and we passed one in seconds, resulting in a date of 1970-01-21T00:53:16.800Z.

timestamp from contract 1731196800                                                                                                                                                                                                 
tokenExpiresDate { TZDate 1970-01-21T00:53:16.800Z timeZone: 'UTC', internal: 1970-01-21T00:53:16.800Z }                                                                                                                           
tomorrow { TZDate 2024-11-03T00:44:49.827Z timeZone: 'UTC', internal: 2024-11-03T00:44:49.827Z }                                                                                                                                   
today { TZDate 2024-11-02T00:44:49.827Z timeZone: 'UTC', internal: 2024-11-02T00:44:49.827Z }

@glitch003 glitch003 changed the title Adding logging to debug Multiply seconds timestamp from chain by 1000 to convert to milliseconds Nov 2, 2024
@glitch003 glitch003 merged commit 7a64756 into main Nov 2, 2024
2 checks passed
@glitch003 glitch003 deleted the fix/not-topping-up-when-needed branch November 2, 2024 01:00
@MaximusHaximus
Copy link
Contributor

👍 Good catch

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