Hi,
I have used Data Modeler to create the db-entities for creating a REST API to a mysql database. Everything is working fine, except when I want to update fields in the database which are datetime fields.
The column is defined in the class like this:
[Column('endeZeitpunkt', [])]
FendeZeitpunkt: Nullable<TDateTime>;
In the TableDictionary class the column is defined like this:
FendeZeitpunkt: TDictionaryAttribute;
and the property looks like this:
property endeZeitpunkt: TDictionaryAttribute read FendeZeitpunkt;
the constructor initializes the field like this:
FendeZeitpunkt := TDictionaryAttribute.Create('endeZeitpunkt');
All endpoints work as expected and I can add, delete and update the data. There is only one issue with the datetime fields. They don't like the ISO-Strings which I produce with the Angular Frontend.
If I provide the value "endeZeitpunkt":"2022-05-18T00:14" all is fine and the patch operation finishes successfully.
However if I provide the value "endeZeitpunkt":"2022-05-17T22:14:00.000Z" then a patch throws the error message as the response:
{
"error": {
"code": "TJsonTypeConverter.EConvertFromJsonError",
"message": "Cannot read JSON property of type \"TDateTime\", invalid value."
}
}
What am I missing here? Any suggestion is highly appreciated. I have to code around that in the angular frontend and I wonder if I did something wrong when creating the xdata service.