from pyld import jsonld
from datetime import date
jsonld.expand({'@context': {'@vocab': 'https://schema.org/'}, '@id': 'https://example.blog/post', 'publicationDate': datetime.date(2021, 1, 11)})
Which gives:
...
File "{venv}/lib/python3.8/site-packages/pyld/jsonld.py", line 3523, in _expand_value
if not (_is_bool(value) or _is_numeric(value) or _is_string(value)):
File "{venv}/lib/python3.8/site-packages/pyld/jsonld.py", line 6402, in _is_numeric
float(v)
TypeError: float() argument must be a string or a number, not 'datetime.date'
Is this intended behavior? If yes, I probably could come up with a PR which would print a human understandable message instead of crash;
If it is not, maybe date and datetime values should be natively supported by the library.
Which gives:
date
anddatetime
values should be natively supported by the library.