-
Notifications
You must be signed in to change notification settings - Fork 748
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
DatePicker: LocalDateTime conversion error when used inside ui:repeat #12234
Comments
Reproducer attached: Tested with 13.0.10 and 14.0.2 its the same issue so its not new whatever it is. |
Might be a Mojarra bug it works in MyFaces.
|
Actually it doesn't Myfaces doesn't throw an error but sets all dates to NOW. |
Actually no it does work in MyFaces. It looks like its setting the second value only because you are using the same variable for both dates. Definitely looks like a Mojarra issue. Reproducer: |
I tested it with Mojarra and without Primefaces, so I replaced datePicker with:
It works. I assume it's a Primefaces bug. When looking at the error message you see that it's a conversion error when trying to convert to Date. This does not happen in plain Faces / Mojarra as you define the data type via the As a workaround I now defined a custom converter and assigned it to |
That is a good workaround but its strange that it works fine in MyFaces. So it might be related to the |
Yes agree, strange that it works in MyFaces. But on the other hand it works in plain Faces / Mojarra within |
OK debugged it. You could also have fixed it by setting |
did you try to debug, why are value type recognition is not working? |
ValueType recognition is working fine it always detects it as a Yes I debugged and the issue is here: protected Temporal convertToJava8DateTimeAPI(FacesContext context, UICalendar calendar, Class<?> type, String submittedValue) {
if (type == LocalDate.class || type == YearMonth.class || (type == LocalDateTime.class && !calendar.hasTime())) { the value of @Override
public boolean hasTime() {
return this.isShowTime() || this.isTimeOnly();
} The value of So for @martingLab that is why i said if on his DatePicker he set But in our DatePicker we try and dynamically determine if if (datePicker.isShowTimeWithoutDefault() == null) {
Class<?> type = datePicker.getValueType();
if (type != null) {
datePicker.setShowTime(LocalDateTime.class.isAssignableFrom(type));
}
else {
datePicker.setShowTime(CalendarUtils.hasTime(pattern));
}
} That is done on the EncodeEnd. But for some reason in the So the fix was to just also check this code in |
Describe the bug
When p:datePicker is used for LocalDateTime and is placed inside ui:repeat, then a strange conversion error is raised. This does not happen for LocalDate and LocalTime.
Reproducer
Here's the code to reproduce:
xhtml:
Backing bean:
Steps to trigger error:
Expected behavior
No response
PrimeFaces edition
Community
PrimeFaces version
13.0.10
Theme
No response
JSF implementation
Mojarra
JSF version
4.0
Java version
17
Browser(s)
No response
The text was updated successfully, but these errors were encountered: