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
Add rangeSeparator attribute to DatePicker #4818
Comments
Good debugging. I think you mean this line 194: case "range": {
String[] parts = submittedValue.split("-");
List<Object> range = new ArrayList<>();
if (parts.length == 2) {
for (String part : parts) {
range.add(super.getConvertedValue(context, component, part));
}
} |
In my sources for 7.0.2 (we have commercial support, and probably there is different license header) the line number is different, but it's the same piece of code. |
By the way I wanted to write my own coverter to custom object (range with two fields "from" and "to"), and with the way this code is written it's impossible to do it. |
same issue here. easy fix would be to change the default separators to include the spaces. I don't know of a Date/Time-Pattern that uses ", " or " - " so this might be a permanent fix unless you decide to customize the separators. proposed code looks like this: |
@youngroman not a bad suggestion. @mertsincan WDYT? I can submit a PR if you think its OK. |
Please note the same issue exists in PF 7.0.4 in datepicker.js. |
@mertsincan the JS piece @Edubits is talking about above is in the shared DatePicker code between PrimeNG, PrimeReact, and PrimeFaces so I am hesitant to touch it. Can you please review? |
Hi @melloware, We can add "rangeSeparator" attribute for this issue. |
Hi @morvael Please use rangeSeparator attribute. Best regards, |
With pattern set to "yyyy-MM-dd" it's impossible to use selectionMode "range". DatePickerRenderer has hardcoded separator string in line 186, and since the number of elements in the parts array isn't equal to 2, it doesn't even try to parse those dates. Please allow to specify different separator string for range and multiple selectionModes.
1) Environment
2) Expected behavior
Getting list with two elements.
3) Actual behavior
Getting empty list.
The text was updated successfully, but these errors were encountered: