4

I would like the DateField to be defaulted to my user's timezone. I've tried DateField.setZoneId() but this really didn't seem to do anything. I then tried to do DateField.setDefaultValue(LocalDateAdjustedForTimeZone) which mostly worked in that the blue box was correctly highlighted but the black outline remained under the server's timezone.enter image description here

Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192

1 Answers1

1

As far as I can see in the Vaadin client component VAbstractCalendarPanel#buildCalendarBody(), there's no way to influence which day is marked with the today CSS style v-datefield-calendarpanel-day-today. The client component Java code about determining "today" looks like:

final Date tmp = new Date();
final Date today = new Date(tmp.getYear(), tmp.getMonth(), tmp.getDate());

So I guess when it's translated to JavaScript it will take the current date on the browser's system.

However, as a workaround you can at least adapt the CSS styles to hide the today marker. I wonder why Vaadin did not think about your use case (which is mine, too). Can you open an issue at Vaadin please?

Steffen Harbich
  • 2,639
  • 2
  • 37
  • 71