hermes icon indicating copy to clipboard operation
hermes copied to clipboard

_to_python methods return string and not date object

Open SKernchen opened this issue 5 months ago • 0 comments

If we expand a date object it returns a value string (https://w3c.github.io/json-ld-syntax/#example-expanded-value-with-type). cont._to_expanded_json("eggs", datetime(2022, 2, 22)) == [ {"@value": "2022-02-22T00:00:00", "@type": "http://schema.org/DateTime"}

However if we do it the other way around (_to_python) we stay at this string output. cont._to_python("http://spam.eggs/eggs", [{ "@value": "2022-02-22T00:00:00", "@type": "https://schema.org/DateTime" }]) == "2022-02-22T00:00:00"

We should return a python date: cont._to_python("http://spam.eggs/eggs", [{ "@value": "2022-02-22T00:00:00", "@type": "https://schema.org/DateTime" }]) == datetime(2022, 2, 22)

SKernchen avatar Sep 18 '25 09:09 SKernchen