mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Support times specified as ISO strings too in date utils, not just datetimes.
This commit is contained in:
@@ -67,7 +67,7 @@ class Usecase:
|
||||
parent=work_time, recurrence_type="WEEKLY")
|
||||
|
||||
# State that we work from weekdays 1 to 5 (i.e. Monday to Friday), 9am to 5pm
|
||||
ifcopenshell.api.run("sequence.edit_recurrence_pattern", mdoel,
|
||||
ifcopenshell.api.run("sequence.edit_recurrence_pattern", model,
|
||||
recurrence_pattern=pattern, attributes={"WeekdayComponent": [1, 2, 3, 4, 5]})
|
||||
ifcopenshell.api.run("sequence.add_time_period", model,
|
||||
recurrence_pattern=pattern, start_time="09:00", end_time="17:00")
|
||||
|
||||
@@ -75,7 +75,10 @@ def datetime2ifc(dt, ifc_type):
|
||||
if isinstance(dt, str):
|
||||
if ifc_type == "IfcDuration":
|
||||
return dt
|
||||
dt = datetime.datetime.fromisoformat(dt)
|
||||
try:
|
||||
dt = datetime.datetime.fromisoformat(dt)
|
||||
except:
|
||||
dt = datetime.time.fromisoformat(dt)
|
||||
|
||||
if ifc_type == "IfcDuration":
|
||||
return isodate.duration_isoformat(dt)
|
||||
|
||||
Reference in New Issue
Block a user