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

TimestampConverter converts timedelta objects as datetime.now(UTC) + timedelta #2300

Open
fubuloubu opened this issue Sep 25, 2024 · 1 comment

Comments

@fubuloubu
Copy link
Member

Not sure if I like that this is the case, or at least I ran into an issue where I expected that putting a timedelta object in the deployment params of a contract that expected a timedelta arg ended up making a quite large timedelta unexpectedly

return int((datetime.now(timezone.utc) + value).timestamp())

Should this converter instead convert timedelta as td.total_seconds(), and then suggest in the docs to do datetime + timedelta for those scenarios where you want it to produce a specific timestamp and not a delta? e.g.

tx = contract.method(..., chain.pending_timestamp + timedelta(hours=1), ...)
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

No branches or pull requests

1 participant