bug4210 Extracted date format creation to a unique place

This commit is contained in:
Benjamin Barth committed 2017-11-20 17:22:33 +01:00
1 parent f816d16639
commit 608319dbf2
3 files changed
+7 -4

No files matched your search

@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.common.client.datetime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
@@ -28,7 +29,7 @@ public class DateAndTimeInput extends AbstractInput {
add(this.timeInput = new TimeInput(accuracy));
dateInput.addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
timeInput.addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
this.dateFormat = DateTimeFormat.getFormat("yyyy-MM-dd");
this.dateFormat = DateInput.DATE_FORMAT;
this.timeFormat = accuracy.getTimeFormat();
this.datetimeFormat = accuracy.getDatetimeFormat();
}
@@ -6,8 +6,10 @@ import com.google.gwt.user.datepicker.client.DateBox;
public class DateInput extends AbstractInput {
static final DateTimeFormat DATE_FORMAT = DateTimeFormat.getFormat("yyyy-MM-dd");
public DateInput() {
super(DateTimeInputType.TIME.isSupported() ? NativeDateTimeInput.date() : new CustomDateBox());
super(DateTimeInputType.TIME.isSupported() ? NativeDateTimeInput.date(DATE_FORMAT) : new CustomDateBox());
}
private static class CustomDateBox extends DateBox {
@@ -16,8 +16,8 @@ class NativeDateTimeInput extends Widget implements DateTimeInput {
private static final String ATTR_TYPE = "type", ATTR_STEP = "step";
static DateTimeInput date() {
return new NativeDateTimeInput(DateTimeInputType.DATE, "", DateTimeFormat.getFormat("yyyy-MM-dd"));
static DateTimeInput date(DateTimeFormat dateFormat) {
return new NativeDateTimeInput(DateTimeInputType.DATE, "", dateFormat);
}
static DateTimeInput time(Accuracy accuracy) {