add datetime test

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923881 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2025-02-17 20:23:13 +00:00
parent dbaf834459
commit 5b12033b99

View File

@ -1421,6 +1421,22 @@ public abstract class BaseTestCell {
}
}
@Test
void testZeroDate() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {
Cell cellA1 = getInstance(wb);
cellA1.setCellValue(1.0);
assertEquals(LocalDate.parse("1900-01-01"),
cellA1.getLocalDateTimeCellValue().toLocalDate());
cellA1.setCellValue(0.0);
// this value is not strictly correct but our time only support relies on this
// time only means cells that have values with just times but no date parts
assertEquals(LocalDate.parse("1899-12-31"),
cellA1.getLocalDateTimeCellValue().toLocalDate());
}
}
@Test
protected void setCellType_FORMULA_onAnArrayFormulaCell_doesNothing() throws IOException {
try (Workbook wb = _testDataProvider.createWorkbook()) {