-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date is shown as null in the backend #747
Comments
From looking at the decompiled source (sorry, but when you need to find out whether it is a bug in your code or mine, decompiling is handy), the bug seems to be in the ValuesAsString method on RecordField, which simply calls ToString() on the value. This is going to use the current system locale when formatting the date, which you should never be doing. You are probably also going to be in trouble in other places, with decimal numbers for instance. I must say I'm surprised to find such a basic mistake in a commercial product. Given that Umbraco is a Danish company, I would at least expect you to test on non en-US locales. I would submit a PR, but obviously I can't do that. So when can I expect this to work correctly? |
Yes, it looks like we shouldn't really be doing a Seems to me we can fix it on the way out though - by parsing back to a date using the current system locale that it will have been serialized with. That then can be formatted client-side, in the way that the current "Created" and "Updated" dates are. We'll look at this for the next release. As you say the "source of truth" data is saved to |
@AndyButland Thank you for the response. Yeah, that sounds like a sensible solution 👍 By the way, I'm loving all the recent improvements to Forms - makes it a lot easier to work with. Especially the localized backoffice, which I know was a ton of work. |
I have a similar problem. |
If I add datepicker to form, it works correctly on the frontend. And it stores data correctly (mostly) in the database.
However, when viewing the record in the backend, the value is displayed as null.
This seems to be due to the server sending the date value as "15.03.2022 00.00.00" (I'm on a machine with da-DK locale). This value is what is stored the the JSON in the RecordData column in the UFRecords table. This date format is obviously incorrect, as it should be in ISO format and not a locale-specific format.
This incorrect format then results in the javascript not being able to parse the date value and as a result, null is displayed.
This is a critical issue, as it is corrupting data stored in the database.
Also, why is everything stored twice? The correct dates are stored in EFRecordDataDateTime. So why do we need the JSON as well?
The text was updated successfully, but these errors were encountered: