Vũ Văn Học
Vũ Văn Học

Reputation: 21

Format date in Vaadin date picker

I'm using Vaadin Date picker 3.3.0

In Java, I set locale as the below code. datePicker.setLocale(Locale.CANADA_FRENCH);

But the date format display is YYYY-MM-dd.

How to format it to: YYYY/MM/dd ?? Thank you!

Upvotes: 2

Views: 1393

Answers (1)

codinghaus
codinghaus

Reputation: 2358

The only way right now to influence the date format of the date picker by using the Java API is to use the locale (like you do).

There is a feature request for setting a date format manually (like datePicker.setDateFormat("YYYY/MM/dd");), maybe you want to give a thumb up on that feature request so that they will implement this soon: https://github.com/vaadin/vaadin-date-picker-flow/issues/156

Also in the comments of that feature request, there is described an alternative approach on how to set a date format manually by not using the Java API, but using JavaScript. Maybe you want to give it a try: https://github.com/vaadin/vaadin-date-picker-flow/issues/156#issuecomment-603904954

Upvotes: 3

Related Questions