diff options
author | Ilia Motornyi <elmot@vaadin.com> | 2018-03-20 15:34:54 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-03-20 15:34:54 +0200 |
commit | ec314ee921b460d8401132bd661575120da60931 (patch) | |
tree | 61dc3e2ca066fdee83e995703f7795e3ea578f01 /uitest | |
parent | 803a453a28c00a38e69e9beabe3efe6590486b3f (diff) | |
download | vaadin-framework-ec314ee921b460d8401132bd661575120da60931.tar.gz vaadin-framework-ec314ee921b460d8401132bd661575120da60931.zip |
Fix date ranges for date and datetime fields (#10685)
Fixes #9765
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimeZones.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimeZones.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimeZones.java new file mode 100644 index 0000000000..be7cd1456b --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimeZones.java @@ -0,0 +1,53 @@ +package com.vaadin.tests.components.datefield; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.datefield.DateResolution; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.InlineDateField; +import com.vaadin.ui.InlineDateTimeField; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class DateFieldTimeZones extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + + InlineDateField d1 = new InlineDateField(); + InlineDateField d2 = new InlineDateField(); + InlineDateTimeField d3 = new InlineDateTimeField(); + InlineDateTimeField d4 = new InlineDateTimeField(); + InlineDateTimeField d5 = new InlineDateTimeField(); + + d1.setValue(LocalDate.of(2018, 1, 1)); + d2.setValue(LocalDate.of(2019, 12, 1)); + d3.setValue(LocalDateTime.of(2019, 12, 1,0,0,0)); + d4.setValue(LocalDateTime.of(2019, 12, 1,0,0,0)); + d4.setValue(LocalDateTime.of(2019, 12, 1,0,0,0)); + + d1.setResolution(DateResolution.DAY); + d2.setResolution(DateResolution.DAY); + + d2.setRangeStart(LocalDate.of(2018, 1, 1)); + d2.setRangeEnd(LocalDate.of(2019, 12, 1)); + + d3.setRangeStart(LocalDateTime.of(2018, 1, 1,0,0,0)); + d3.setRangeEnd(LocalDateTime.of(2019, 12, 1,0,0,0)); + + d5.setRangeStart(LocalDateTime.of(2018, 1, 1,0,0,0)); + d5.setRangeEnd(LocalDateTime.of(2019, 12, 1,0,0,0)); + + d5.setZoneId(ZoneId.of("-10")); + HorizontalLayout layout = new HorizontalLayout(); + layout.addComponents(d1, d2,d3,d4,d5); + + addComponent(layout); + } + +} |