Datetime Format leads to error when mapping from a Datetime Picker
We recognized, that the date format from a Datetime picker is different than in version 9.
In the userinput it is shown for example as 2022-04-13T22:02:00.000Z
We could work around this format, as we just mapped the userinput into a custom exstension field from type datetime.
Since version 11.4.1 we receive the following error message whenever we map a date into one of these extension date fields:
2022-04-11 15:19:09,710, ERROR [ 53]: The zDate01 property caused an exception and cannot be set.
2022-04-11 15:19:09,732, ERROR [ 53]: System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at Cireson.ServiceManager.DAL.ObjectProperties.SetObjectValue(EnterpriseManagementObject emo, ManagementPackClass mpc, String propertyName, JToken currentState, Boolean isIOStream, String baseId, Boolean isNew)
Has anyone else received that error as well? Is this a Cireson issue/bug or is there something wrong in our system?
Best Answer
-
Simon_Zeinhofer Customer Ninja IT Monkey ✭✭✭✭
John Doyle provided a workaround and it seems this issue has been resolved in 11.6.1
1
Answers
@Simon_Zeinhofer - Can you validate that the above formatting is what's being mapped into the custom date field? I expect that format to be able to parse into a date. Maybe try mapping it to a string field first to see what you're getting.
Hello Justin,
when we map the Date into a custom string field it has the following format:
dd.MM.yyyy HH:mm
For example when I select the 14th of April, this is mapped into the zString field: 14.04.2022 00:02
@Justin_Workman
I found out why this happens.
As I have my language set to english and my datetime settings to german, everytime I pick a date in a datetime picker, the day and month are switched - So if I type in 5th of April, it will be converted to 4th of March, as well as 2 hours are added to it (which I don't know why as well). So when I pick e.g. the 22nd of April it throws an error, as it would be converted to 4th of the 22nd month.
When my colleague does the same, it works, as his datetime settings are set to english. But also there 2 hours are added to the selection.
I opened a ticket about this, but maybe someone has the same issue and might help.
@Justin_Workman since version 11.5 the same issue appears in reverse:
When a user has english format configured in the settings, the day and month swap and everything above 12th leads to an error in the log.
What happens as well, is, that 2 hours get substracted from the date, and this is shown in the userinput (Maybe this is because the format in the userinput has changed from UTZ to Z?), and in the date field, where we map it, 2 hours are added to the selcted date.
As we map selected dates to scheduled start and end date in changes, we need to fix that - Do you have any idea what causes this issue and how we can solve it? :)
John Doyle provided a workaround and it seems this issue has been resolved in 11.6.1