Converters cannot convert datetime.timedelta to float.
See original GitHub issuehello devs. During a conversation about an issue of graphql-core @jkimbo found a possible error
raising something like { "message": "float() argument must be a string or a number, not 'datetime.timedelta'" }
you can check https://github.com/graphql-python/graphql-core/issues/150 for more info.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Converting a timedelta to a float - Make More Machines
The problem You need to convert a time difference into a floating point quantity, like 2.5 days. Or you may want to do...
Read more >Convert timedelta to floating-point - python - Stack Overflow
I got a timedelta object from the subtraction of two datetimes. I need this value as floating point for further calculations.
Read more >converting timedelta to float | Edureka Community
Use the following piece of code: x1=datetime.timedelta(days=3000, seconds=0, microseconds=0, milliseconds=0, minutes=40, hours=5, weeks=8)
Read more >how to convert datetime.timedelta to float Code Example
instead, can convert timedelta to float of second time_d_float = time_d.total_seconds()
Read more >Time series / date functionality — pandas 1.5.2 documentation
Similar to datetime.timedelta from the standard library. ... Rounding during conversion from float to high precision Timestamp is unavoidable.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is a bad bot. This is still an issue.
I managed to get an human readlable for string type by using
duration = graphene.String()
https://github.com/dionyself/leaky/blob/71ec608204a3dd66f2fcd25ff36096ba25eb62bc/warehouses/schema/query/asset.py#L8-L13
We probably won’t need and human readable for the Float converter, so using timedelta.total_seconds() is fine… but, i think this works in py3 only