Oh, ok.... but the code from tandraschko is not working for me...
extractPattern() is causing the issue... I cannot cast etc.?
Calendar support for LocalDate and LocalDateTime
when can this be integrated? I´ve changed my whole project now to LocalTime / LocalDateTime. I thought it´s already there....Melloware wrote: ↑09 Apr 2019, 19:22Its slated for 7.1 and no one has fixed it yet: https://github.com/primefaces/primefaces/issues/4646
PF 8.0
Not until 7.1 because it requires Java 8. PF 7.0 was still Java7 and PF7.1 will be the first version to switch to Java 8.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
7.1 most like not until the EOY 2019.
As for your issue. keep googling and stack overflowing, that you are trying to do definitely works...
As for your issue. keep googling and stack overflowing, that you are trying to do definitely works...
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
-
- PrimeFaces Core Developer
- Posts: 3979
- Joined: 03 Dec 2010, 14:11
- Location: Bavaria, DE
- Contact:
A converter works fine - no idea why my converter it doesn't work in your application. It works fine for me.
Thomas Andraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
PrimeFaces | PrimeFaces Extensions
Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE
Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko
-
- Posts: 79
- Joined: 25 Mar 2013, 13:00
You shared the converter for localdate but the class name is LocalDateTimeConverter, can you post also the LocalDateTime converter?tandraschko wrote: ↑20 Mar 2018, 10:56Thats my converter
Code: Select all
@Named @ApplicationScoped @FacesConverter(forClass = LocalDate.class) public class LocalDateTimeConverter implements Converter { @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern(extractPattern(component, context)); try { return LocalDate.parse(value, formatter); } catch (Exception e) { return null; } } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if (value == null || (value instanceof String && StringUtils.isBlank((String) value))) { return ""; } DateTimeFormatter formatter = DateTimeFormatter.ofPattern(extractPattern(component, context)); return formatter.format((LocalDate) value); } private String extractPattern(UIComponent component, FacesContext context) { // try to get infos from calendar component if (component instanceof Calendar) { Calendar calendarComponent = (Calendar) component; return calendarComponent.getPattern(); } return null; } }
-
- Information
-
Who is online
Users browsing this forum: No registered users and 48 guests