1

I am working on a PrimeFaces project and since the 10.0 migration the p:calendar component in my xhtml is deprecated. I have replaced it with p:datePicker, but I don't know if I can still use these line of codes to get the DatePicker instance in the bean:

Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);

Also, do I have to convert my Dates to LocalDate?

I have tried to keep these lines of codes that were working with the p:calendar component, but it doesn't fire the methods associated in the p:ajax tag.

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
rookie
  • 13
  • 2

1 Answers1

1

Although, technically, if you write a converter, it will be possible to use Calendar with p:datePicker. However, I would bite the bullet and migrate to the Java 8 date time API instead of converting your Calendars to Date. If you are already using Dates, you can use them with the p:datePicker (although I would still consider converting them to a more modern type).

See also:

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102