@Test public void test_get_style_works_for_styles_with_time_suffix() { Locale locale = defaultLocale(); DateDisplay component = new DateDisplay("short_t", new Date(), locale); DateFormat dateFormat = component.getDateFormat(); assertEquals(dateFormat, DateFormat.getTimeInstance(DateFormat.SHORT, locale)); }
DateFormat getDateFormat() { int style = getStyle(isSuffixPresent() ? formatWithoutSuffix() :format); DateFormat dateFormat; if(style < 0) { return new SimpleDateFormat(format, locale); } if(format.endsWith("_t")) { dateFormat = DateFormat.getTimeInstance(style, locale); } else if(format.endsWith("_dt")) { dateFormat = DateFormat.getDateTimeInstance(style, style, locale); } else { dateFormat = DateFormat.getDateInstance(style, locale); } return dateFormat; }
DateDisplay { DateFormat getDateFormat() { int style = getStyle(isSuffixPresent() ? formatWithoutSuffix() :format); DateFormat dateFormat; if(style < 0) { return new SimpleDateFormat(format, locale); } if(format.endsWith("_t")) { dateFormat = DateFormat.getTimeInstance(style, locale); } else if(format.endsWith("_dt")) { dateFormat = DateFormat.getDateTimeInstance(style, style, locale); } else { dateFormat = DateFormat.getDateInstance(style, locale); } return dateFormat; } }
DateDisplay { DateFormat getDateFormat() { int style = getStyle(isSuffixPresent() ? formatWithoutSuffix() :format); DateFormat dateFormat; if(style < 0) { return new SimpleDateFormat(format, locale); } if(format.endsWith("_t")) { dateFormat = DateFormat.getTimeInstance(style, locale); } else if(format.endsWith("_dt")) { dateFormat = DateFormat.getDateTimeInstance(style, style, locale); } else { dateFormat = DateFormat.getDateInstance(style, locale); } return dateFormat; } DateDisplay();   DateDisplay(String format, Date value, Locale locale); }
DateDisplay { DateFormat getDateFormat() { int style = getStyle(isSuffixPresent() ? formatWithoutSuffix() :format); DateFormat dateFormat; if(style < 0) { return new SimpleDateFormat(format, locale); } if(format.endsWith("_t")) { dateFormat = DateFormat.getTimeInstance(style, locale); } else if(format.endsWith("_dt")) { dateFormat = DateFormat.getDateTimeInstance(style, style, locale); } else { dateFormat = DateFormat.getDateInstance(style, locale); } return dateFormat; } DateDisplay();   DateDisplay(String format, Date value, Locale locale);  }
DateDisplay { DateFormat getDateFormat() { int style = getStyle(isSuffixPresent() ? formatWithoutSuffix() :format); DateFormat dateFormat; if(style < 0) { return new SimpleDateFormat(format, locale); } if(format.endsWith("_t")) { dateFormat = DateFormat.getTimeInstance(style, locale); } else if(format.endsWith("_dt")) { dateFormat = DateFormat.getDateTimeInstance(style, style, locale); } else { dateFormat = DateFormat.getDateInstance(style, locale); } return dateFormat; } DateDisplay();   DateDisplay(String format, Date value, Locale locale);   }