From ec314ee921b460d8401132bd661575120da60931 Mon Sep 17 00:00:00 2001 From: Ilia Motornyi Date: Tue, 20 Mar 2018 15:34:54 +0200 Subject: Fix date ranges for date and datetime fields (#10685) Fixes #9765 --- .../components/datefield/DateFieldTimeZones.java | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldTimeZones.java (limited to 'uitest/src') 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); + } + +} -- cgit v1.2.3