Is it possible to map a Date field to Events start field (which is of type DateTime). If not: Is it possible to have use a widget for DateTime that only shows 'Date'. ( If possible, I would prefer to avoid hiding the 'time part' with CSS).
It is possible to map a Date field to a DateTime field by setting a default value for the time part. The exact implementation may vary depending on the language or framework used. However, if you prefer to display and select only the date part without the time component, you can use a date picker widget.
Examples include HTML5's
I have some python code that can do this, but I was hoping there was a way to do it 'directly in Easyform'.
I was hoping it was possible to do this 'with python', so something like this (not working… dato is the Easyform Date field and 'start' is the Event's start field):
You can use Python code to map a Date field to an Event's start field directly. By utilizing the
datetime.combine() function, you can convert the Date field value to a datetime object with a default time component. This allows you to assign the converted value to the Event's start field. This approach enables you to achieve the desired mapping without relying on external libraries or complex workarounds.
from datetime import datetime
dato_value = dato
start_value = datetime.combine(dato_value, datetime.min.time())
start = start_value