ICU-13006 DateFormat.setNumberFormat should clone the NumberFormat and also call setGroupingUsed(false)
X-SVN-Rev: 40198
This commit is contained in:
parent
4a499c9a77
commit
2cea868e02
@ -586,6 +586,7 @@ DateFormat::adoptNumberFormat(NumberFormat* newNumberFormat)
|
||||
delete fNumberFormat;
|
||||
fNumberFormat = newNumberFormat;
|
||||
newNumberFormat->setParseIntegerOnly(TRUE);
|
||||
newNumberFormat->setGroupingUsed(FALSE);
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
@ -2684,6 +2684,9 @@ void NumberFormatRegressionTest::TestJ691(void) {
|
||||
|
||||
// *** Here's the key: We don't want to have to do THIS:
|
||||
// nf->setParseIntegerOnly(TRUE);
|
||||
// or this (with changes to fr_CH per cldrbug:9370):
|
||||
// nf->setGroupingUsed(FALSE);
|
||||
// so they are done in DateFormat::adoptNumberFormat
|
||||
|
||||
// create the DateFormat
|
||||
DateFormat *df = DateFormat::createDateInstance(DateFormat::kShort, loc);
|
||||
|
@ -1571,11 +1571,12 @@ public abstract class DateFormat extends UFormat {
|
||||
*/
|
||||
public void setNumberFormat(NumberFormat newNumberFormat)
|
||||
{
|
||||
this.numberFormat = newNumberFormat;
|
||||
this.numberFormat = (NumberFormat)newNumberFormat.clone();
|
||||
/*In order to parse String like "11.10.2001" to DateTime correctly
|
||||
in Locale("fr","CH") [Richard/GCL]
|
||||
*/
|
||||
this.numberFormat.setParseIntegerOnly(true);
|
||||
this.numberFormat.setGroupingUsed(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,8 +73,9 @@ public class NumberFormatRegressionTest extends com.ibm.icu.dev.test.TestFmwk {
|
||||
|
||||
// *** Here's the key: We don't want to have to do THIS:
|
||||
//nf.setParseIntegerOnly(true);
|
||||
// However with changes to fr_CH per cldrbug:9370 we have to do the following:
|
||||
nf.setGroupingUsed(false);
|
||||
// or this (with changes to fr_CH per cldrbug:9370):
|
||||
//nf.setGroupingUsed(false);
|
||||
// so they are done in DateFormat.setNumberFormat
|
||||
|
||||
// create the DateFormat
|
||||
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, loc);
|
||||
|
Loading…
Reference in New Issue
Block a user