From 0f7af13adf1b5451842fc35a00d873ddb1a2e577 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Fri, 12 Apr 2013 10:09:10 +0300 Subject: [PATCH] Fixed date reset when calendar is first initialized #11387 Change-Id: I48a839cceeab3cfc6722657eac8681a8766ab396 --- server/src/com/vaadin/ui/DateField.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java index 78c86ceb00..1a8955801b 100644 --- a/server/src/com/vaadin/ui/DateField.java +++ b/server/src/com/vaadin/ui/DateField.java @@ -19,8 +19,10 @@ package com.vaadin.ui; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; @@ -594,8 +596,11 @@ public class DateField extends AbstractField implements calendar = Calendar.getInstance(); // Start by a zeroed calendar to avoid having values for lower // resolution variables e.g. time when resolution is day + int min, field; for (Resolution r : Resolution.getResolutionsLowerThan(resolution)) { - calendar.set(r.getCalendarField(), 0); + field = r.getCalendarField(); + min = calendar.getActualMinimum(field); + calendar.set(field, min); } calendar.set(Calendar.MILLISECOND, 0); } -- 2.39.5