From ab102176cc8e34146140982edea62ee3fce8a28e Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 17 Feb 2021 21:12:04 +1100 Subject: [PATCH] IfcOpenShell date util now supports converting to IFC2X3 date entities --- src/ifcopenshell-python/ifcopenshell/util/date.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/util/date.py b/src/ifcopenshell-python/ifcopenshell/util/date.py index 1da652f74e..d1b0ad5d7e 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/date.py +++ b/src/ifcopenshell-python/ifcopenshell/util/date.py @@ -45,3 +45,8 @@ def datetime2ifc(dt, ifc_type): return dt.date().isoformat() elif ifc_type == "IfcTime": return dt.time().isoformat() + elif ifc_type == "IfcCalendarDate": + return {"DayComponent": dt.day, "MonthComponent": dt.month, "YearComponent": dt.year} + elif ifc_type == "IfcLocalTime": + # TODO implement timezones + return {"HourComponent": dt.hour, "MinuteComponent": dt.minute, "SecondComponent": dt.second}