git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892092 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-08-07 19:52:00 +00:00
parent 4123427bae
commit cb52f97e3c
2 changed files with 7 additions and 4 deletions

View File

@ -78,10 +78,10 @@ public class DateUtil {
private static final Pattern date_ptrn5 = Pattern.compile("^\\[DBNum([123])]");
private static final DateTimeFormatter dateTimeFormats = new DateTimeFormatterBuilder()
.appendPattern("[dd MMM[ yyyy]][[ ]h:m[:s] a][[ ]H:m[:s]]")
.appendPattern("[[yyyy ]dd-MMM[-yyyy]][[ ]h:m[:s] a][[ ]H:m[:s]]")
.appendPattern("[M/dd[/yyyy]][[ ]h:m[:s] a][[ ]H:m[:s]]")
.appendPattern("[[yyyy/]M/dd][[ ]h:m[:s] a][[ ]H:m[:s]]")
.appendPattern("[dd MMM[ yyyy]][[ ]h:m[:s][.SSS] a][[ ]H:m[:s][.SSS]]")
.appendPattern("[[yyyy ]dd-MMM[-yyyy]][[ ]h:m[:s][.SSS] a][[ ]H:m[:s][.SSS]]")
.appendPattern("[M/dd[/yyyy]][[ ]h:m[:s][.SSS] a][[ ]H:m[:s][.SSS]]")
.appendPattern("[[yyyy/]M/dd][[ ]h:m[:s][.SSS] a][[ ]H:m[:s][.SSS]]")
.parseDefaulting(ChronoField.YEAR_OF_ERA, LocaleUtil.getLocaleCalendar().get(Calendar.YEAR))
.toFormatter();

View File

@ -63,6 +63,9 @@ final class TestTimeValue {
confirmTimeValue(new StringEval("12:00"), 0.5); // Serial number of a time entered as text.
confirmTimeValue(new StringEval("6:00 PM"), 0.75); // Serial number of a time entered as text.
confirmTimeValue(new StringEval("12:03:45"), 0.5026041666642413); // Serial number of a time entered as text.
// this is not yet right as the milliseconds are not counted - but this used to cause a parse issue before
confirmTimeValue(new StringEval("12:03:45.386"), 0.5026041666642413);
} finally {
LocaleUtil.setUserLocale(null);
}