-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
Prevent invalid date written into xml #7321
Prevent invalid date written into xml #7321
Conversation
@wangf1122 it works, but maybe a better solution to avoid checking the text of the error could be to update the following code: core-geonetwork/web-ui/src/main/resources/catalog/components/edit/datepicker/DatePickerDirective.js Lines 181 to 185 in 79865d1
Checking |
Yeah, I think the code you showed is the better place. It is where the variable was initiated. I tested and it works good. I did make the code update to this comment |
@wangf1122 my proposal was a bit different, to avoid checking the text value
|
I have tested your code and works good. I made another commit for it. |
* Prevent invalid date written into xml * set invalid date prevention at the variable initiating place * default date and check isValid
This issue happens in both GN4 and lower versions (3.12).
If the user select datetime for the field, pick a time but not a date.
Switch to xml view first time, the field will just render empty string which has no ill effect on the Java side because Java ISO date will just use default date 1970-01-01
switch between xml view and UI view second time (or validate the records couple of times).
The "Invalid Date" string was put to the xml.
This can cause the xml parser on Java side returns some exception.
This "Invalid Date" is some error message when trying to initiate a Date object in Javascript and this can be ignored