Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alkidbaci committed Nov 13, 2024
1 parent ef2444e commit 3368a65
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions owlapy/owl_literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,14 +734,20 @@ class _OWLDateAndTimeLiteralInterface(_OWLLiteralBasicsInterface):

def __init__(self, value, type_=None):
if isinstance(value, datetime) or type_ is DateTimeOWLDatatype:
value = value.replace("Z", "+00:00") if isinstance(value, str) and value[-1] == "Z" else value
value = datetime.fromisoformat(value)
if isinstance(value, str):
if value[-1] == "Z":
value = value.replace("Z", "+00:00")
value = datetime.fromisoformat(value)
if isinstance(value, date) or type_ is DateOWLDatatype:
value = value.replace("Z", "+00:00") if isinstance(value, str) and value[-1] == "Z" else value
value = date.fromisoformat(value)
if isinstance(value, str):
if value[-1] == "Z":
value = value.replace("Z", "+00:00")
value = date.fromisoformat(value)
if isinstance(value, time) or type_ is TimeOWLDatatype:
value = value.replace("Z", "+00:00") if isinstance(value, str) and value[-1] == "Z" else value
value = time.fromisoformat(value)
if isinstance(value, str):
if value[-1] == "Z":
value = value.replace("Z", "+00:00")
value = time.fromisoformat(value)
if isinstance(value, Timedelta) or type_ is DurationOWLDatatype:
value = Timedelta(value) if isinstance(value, str) else value
assert type(value) in [datetime, date, time, Timedelta]
Expand Down

0 comments on commit 3368a65

Please sign in to comment.