mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
[bug-65471] fix DataFormatter so it can handle Ts (ISO 8601)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891864 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6315a2260f
commit
abe5131997
@ -101,17 +101,24 @@ final class TestText {
|
||||
ValueEval numArg = new NumberEval(321.321);
|
||||
ValueEval formatArg = new StringEval("dd:MM:yyyy hh:mm:ss");
|
||||
ValueEval[] args = { numArg, formatArg };
|
||||
ValueEval result = TextFunction.TEXT.evaluate(args, -1, (short)-1);
|
||||
ValueEval result = TextFunction.TEXT.evaluate(args, -1, -1);
|
||||
ValueEval testResult = new StringEval("16:11:1900 07:42:14");
|
||||
assertEquals(testResult.toString(), result.toString());
|
||||
|
||||
// Excel also supports "m before h is month"
|
||||
formatArg = new StringEval("dd:mm:yyyy hh:mm:ss");
|
||||
args[1] = formatArg;
|
||||
result = TextFunction.TEXT.evaluate(args, -1, (short)-1);
|
||||
result = TextFunction.TEXT.evaluate(args, -1, -1);
|
||||
testResult = new StringEval("16:11:1900 07:42:14");
|
||||
assertEquals(testResult.toString(), result.toString());
|
||||
|
||||
// Excel also supports ".SSS"
|
||||
formatArg = new StringEval("dd:mm:yyyy hh:mm:ss.SSS");
|
||||
args[1] = formatArg;
|
||||
result = TextFunction.TEXT.evaluate(args, -1, -1);
|
||||
testResult = new StringEval("16:11:1900 07:42:14.014");
|
||||
assertEquals(testResult.toString(), result.toString());
|
||||
|
||||
// this line is intended to compute how "November" would look like in the current locale
|
||||
// update: now the locale will be (if not set otherwise) always Locale.getDefault() (see LocaleUtil)
|
||||
DateFormatSymbols dfs = DateFormatSymbols.getInstance(LocaleUtil.getUserLocale());
|
||||
@ -150,7 +157,7 @@ final class TestText {
|
||||
formatArg = new StringEval("yyyy-mm-ddThh:MM:ss.000");
|
||||
args[1] = formatArg;
|
||||
result = TextFunction.TEXT.evaluate(args, -1, -1);
|
||||
testResult = new StringEval("16:11:1900 07:42:14.400");
|
||||
testResult = new StringEval("1900-11-16T07:42:14.400");
|
||||
assertEquals(testResult.toString(), result.toString());
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user