Applying my fix to LANG-645, and Mikael's test case; fixing the FastDateFormat to properly include the locale when formatting a Date
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@993620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f7f19a3d2f
commit
14a0cc2a9b
|
@ -817,7 +817,7 @@ public class FastDateFormat extends Format {
|
|||
* @return the formatted string
|
||||
*/
|
||||
public String format(Date date) {
|
||||
Calendar c = new GregorianCalendar(mTimeZone);
|
||||
Calendar c = new GregorianCalendar(mTimeZone, mLocale);
|
||||
c.setTime(date);
|
||||
return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString();
|
||||
}
|
||||
|
|
|
@ -322,4 +322,16 @@ public class FastDateFormatTest extends TestCase {
|
|||
FastDateFormat format = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("GMT"));
|
||||
assertEquals("dateTime", dateTime, format.format(cal));
|
||||
}
|
||||
|
||||
public void testLang645() {
|
||||
Locale locale = new Locale("sv", "SE");
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(2010, 0, 1, 12, 0, 0);
|
||||
Date d = cal.getTime();
|
||||
|
||||
FastDateFormat fdf = FastDateFormat.getInstance("EEEE', week 'ww", locale);
|
||||
|
||||
assertEquals("fredag, week 53", fdf.format(d));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue