-
Notifications
You must be signed in to change notification settings - Fork 16
Update format-date to return empty string instead of 'Invalid Date' #155
Conversation
I think there are still place(s) where a date can be converted into the string |
@alxndrsn I have done some digging (but am by no means an expert on this code base) and I have not found any other xPath functions that will directly return the String value That being said, the actual
If no number value is entered, the note will show: Does it make sense to try and update the {
"t": "arr",
"v": [ {} ]
} Seems like that kind of change might have a lot of unintended side-effects, but I am not sure. |
This is a suggested change for enketo#155 so that: - `asDate` still consistently returns a `Date` instance as one would expect - `BlankDate` documents the purpose of its behavior
This is a suggested change for enketo#155 so that: - `asDate` still consistently returns a `Date` instance as one would expect - `BlankDate` documents the purpose of its behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For such a small change, this review was a bit of a wild ride! First I mistook the purposes of the changes entirely, then I got a little nitpicky, then I really stared at it for a while until I decided to try another approach entirely.
This change does certainly work as expected, but I think the alternative approach with a subclass will likely be easier to understand for future maintenance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thank you!
Updates the
format-date
xPath function to return''
instead of'Invalid Date'
when provided with an empty value or invalid date.This normalizes the behavior with
1.x
of openrosa and also with JavaRosa. See the linked issue for more information.Closes enketo/enketo#864