]> source.dussan.org Git - vaadin-framework.git/commit
Allow AbstractDateField to provide DST zone names over custom ranges (#11927)
authorTarek Oraby <42799254+tarekoraby@users.noreply.github.com>
Tue, 21 Apr 2020 09:22:45 +0000 (12:22 +0300)
committerGitHub <noreply@github.com>
Tue, 21 Apr 2020 09:22:45 +0000 (12:22 +0300)
commit01936188ca3105271109e7b8a5ede42e8a1cc1d8
tree2d11c192ffa55050e97cd87419b124d56272ed76
parentd35bd4cde4ae0074d68c7e1f10f2be8757403cc7
Allow AbstractDateField to provide DST zone names over custom ranges (#11927)

DateTimeField and DateField currently implement a hardcoded logic by which they adjust their time zone names to display daylight-saving time (DST) zone names. Specifically, this hardcoded logic only adjusts the displayed date to DST format if that date falls in one of the years between 1980 and the following 20 years in the future from the current date (that is, until 2040 at the time of this commit).

For some use cases, this is problematic because it is desirable to display proper DST-adjusted time zones beyond the 20 years limit (and possibly also before 1980).

Rather than choosing another arbitrary, hardcoded threshold, this commit extends the AbstractDateField API to allow the user to choose the range (start and end years) between which the DST transition dates are calculated (and hence displayed properly). If the user doesn't invoke this new API, DateTimeField and DateField will default to behave according the existing logic (i.e. display DST zone names between 1980 and 20 years into the future).

Closes #11919
server/src/main/java/com/vaadin/ui/AbstractDateField.java
server/src/main/java/com/vaadin/util/TimeZoneUtil.java
uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldZoneIdFutureSummerDates.java [new file with mode: 0644]
uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldZoneIdFutureSummerDatesTest.java [new file with mode: 0644]