Vaadin and Java 8 date/time api

Hey all, so I was wondering if anyone else has converted / built their application to use the new date / time api in Java 8, and if so, how did you handle the UI portion of your code? I was just trying to convert my application to store an Instant class instead of a Date, and when using a FieldGroup to bind it, i’ve got some BeanValidation errors being thrown because of an inconvertable type.

Hi,

The built in Date field don’t support new Java 8 types yet, and probably won’t until java 8 support is required. So don’t hold your breath there. You could write a Converter to tackle the issue.

A while ago I also created a project for Java 8 date fields, but so far there is only a field for
LocalDateTime
. If you want to continue that project, I’d be honoured to receive some pull requests via github.

cheers,
matti

I did end up going down the converter route. Is there any reason that a converter isn’t added to Vaadin core so people won’t have to write their own in the future?

It seems like a smart move, considering how many people use Joda Time for pre-jdk8 projects, or the new java.time api now.

Vaadin is built with oldest supported JDK to ensure the compatibility. So we cannot bring them to core yet. But as said, a quality add-on would be awsome help for the community. And when we finally drop jdk 7 support ( not soon ) the components from the add-on could probably be moved as such (or with package name change) to the core.

cheers,
matti

Ah that does make sense, though it does suck that making new features available has to be delayed, especially when those new features are now preferred to the old.

Yep, a small drawback, but there are lots of big customers who are stuck with various ancient technologies :frowning: Luckily using extensions is really easy powerful way to bypass this inconvenience. It is also often the best way to prototype with new components before bringing them to the core library. We actually should have done this more with e.g. Grid.

cheers,
matti