aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcases/org/apache/poi')
-rw-r--r--src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java
index 05da127bd9..055e997650 100644
--- a/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java
+++ b/src/testcases/org/apache/poi/ss/formula/functions/TestDateValue.java
@@ -19,6 +19,10 @@ package org.apache.poi.ss.formula.functions;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import java.time.LocalDate;
+import java.time.Month;
+import java.time.Year;
+import java.time.temporal.ChronoUnit;
import java.util.Locale;
import org.apache.poi.ss.formula.eval.BlankEval;
@@ -52,14 +56,18 @@ public final class TestDateValue {
public void testDateValue() {
LocaleUtil.setUserLocale(Locale.ENGLISH);
try {
+ int days1900 = (int)ChronoUnit.DAYS.between(
+ LocalDate.of(1899, Month.DECEMBER, 31),
+ LocalDate.of(Year.now().getValue(), Month.FEBRUARY, 1)
+ )+1;
confirmDateValue(new StringEval("2020-02-01"), 43862);
confirmDateValue(new StringEval("01-02-2020"), 43862);
confirmDateValue(new StringEval("2020-FEB-01"), 43862);
confirmDateValue(new StringEval("2020-Feb-01"), 43862);
confirmDateValue(new StringEval("2020-FEBRUARY-01"), 43862);
- confirmDateValue(new StringEval("FEB-01"), 43862);
+ confirmDateValue(new StringEval("FEB-01"), days1900);
confirmDateValue(new StringEval("2/1/2020"), 43862);
- confirmDateValue(new StringEval("2/1"), 43862);
+ confirmDateValue(new StringEval("2/1"), days1900);
confirmDateValue(new StringEval("2020/2/1"), 43862);
confirmDateValue(new StringEval("2020/FEB/1"), 43862);
confirmDateValue(new StringEval("FEB/1/2020"), 43862);