-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
type='date' calculation does not convert number to date #651
Comments
Trying to reproduce |
You’ve been on some fun 🗓 adventures 🕰, @MartijnR! This is absolutely the right place to file. Looks like an underlying type coercion issue to me. @neal0892 an ignored test to formally document the limitation would be most welcome. My hunch is that the fix will not be a good candidate for a first PR. |
@lognaturel that makes sense to me ...thanks |
You could just insert the
Updated Excel master date-calcs-javarosa-bug_.xlsx |
That's very interesting, @dimwight. The type is supposed to be inferred based on the field type. It's extremely odd that forcing the type outside of the expression makes a difference and maybe that's a hint as to where the problem is. I would expect |
I've been exploring further how JR handles dates, partly stimulated by the work that resulted in #652. Without even delving into the code it looks like some sense can be made of the underlying logic. It's easier to look in the hierarchy view to see what's going on. So in the form defined by date-calcs-651.xlsx you can see clearly which calculations evaluate to numbers and which to dates.
Since this all perfectly logical and enables arbitrary calculations on dates, perhaps the current code is adequate? |
Software versions
Collect 2021.2.4
Problem description
This form causes an "No partial converter found for type: java.lang.integer" exception after filling in a date and continuing to the next page (XLSForm here)
date-calcs-javarosa-bug.xml.txt
It's this line:
Expected behavior
For the calculation result to be converted to a date like
2021-12-01
.Other information
Not sure if this belongs under Collect or JavaRosa. I guessed.
I realize this use case may be considered too obscure, but I happened to notice it so wanted to report it.
The text was updated successfully, but these errors were encountered: