Closed DumbergerL closed 1 year ago
👍
Attention:
The createFromFormat-Method uses the current time when it only receives a date! This method should therefore only be used for dates with time!
$date = DateTime::createFromFormat("Y-m-d", "2021-06-21");
var_dump($date->getTimestamp());
var_dump($date->format("Y-m-d H:i:s"));
Convert date-fields (e.q. startDate, endDate) to DateTime objects instead of strings.
Attention: Time is in UTC-Format (https://github.com/5pm-HDH/churchtools-api/issues/138#issuecomment-1568102822)
One potential solution is to introduce an additional getter that returns the start date as a converted date-time value:
getStartDate()
: Returns the start date as a string.getStartDateAsDateTime()
: Returns the start date as a converted date-time object.However, this approach has a drawback. The internal type of the start date would still be a string. Consequently, the conversion would occur only when the getter is called, and the "FillWithData" trait would not guarantee that the input provided is of type date.