If you want user locale date/time to be displayed, you can set the date with the specific time zone, e.g. dateField.setValue(LocalDate.now(ZoneId.of("Asia/Shanghai"))).
If you want to change how the date is displayed, you can set the locale with dateField.setLocale(Locale.GERMAN).
Generally, you can change how the date is formatted with dateField.setDateFormat(). Zone ID set with dateField.setZoneId() is used when z is included in this date format.
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.
Actually I’m trying to do something different. Basically I want to change how the datefield popup screen looks. The attached screenshot shows what I mean by the outine.
Okay, now I understand that you want to move the black outline to the date of the user’s current date.
The black outline is currently applied based on the browsers’s time zone. The highlighted code in
VAbstractCalendarPanel is running as JavaScript in the browser. I don’t see an easy way of changing that without modifying the framework. Of course you can always copy the file, overwrite the relevant part and swap the original with the modified in the widgetset, but that isn’t a future proof solution.
I suggest you open an
issue on Github to request this feature. At least to me it sounds logical that setZoneId() changes current date as well to the given zone.