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

fixed string representation of timestamp edgecase #123

Open
wants to merge 3 commits into
base: release/1.0.0
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions openrarity/token/metadata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ def validate_metadata(values):
case "number":
values["value"] = float(value)
case "date":
values["value"] = (
value
if isinstance(value, (int | float))
else datetime.fromisoformat(value).timestamp()
)
if isinstance(value, (int | float)):
values["value"] = value
elif isinstance(value, str) and value.replace(".", "",1).isdigit():
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure you are using the pre-commit formatters that are included. It looks like the formatting on the 1 is missing a space. So just double check that your IDE is applying formatting on save and on commit. Otherwise, I think this is good.

values["value"]= float(value)
else:
values["value"]= datetime.fromisoformat(value).timestamp()
case _:
values["display_type"] = "string"
# values["value"] = (
Expand Down