You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2020/05/16 08:17:33 UTC

svn commit: r1877801 - /poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateValue.java

Author: fanningpj
Date: Sat May 16 08:17:32 2020
New Revision: 1877801

URL: http://svn.apache.org/viewvc?rev=1877801&view=rev
Log:
forbidden-apis-check issues

Modified:
    poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateValue.java

Modified: poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateValue.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateValue.java?rev=1877801&r1=1877800&r2=1877801&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateValue.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/formula/functions/DateValue.java Sat May 16 08:17:32 2020
@@ -33,6 +33,7 @@ import org.apache.poi.ss.formula.eval.Nu
 import org.apache.poi.ss.formula.eval.OperandResolver;
 import org.apache.poi.ss.formula.eval.ValueEval;
 import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.util.LocaleUtil;
 
 /**
  * Implementation for the DATEVALUE() Excel function.<p>
@@ -101,7 +102,7 @@ public class DateValue extends Fixed1Arg
                     }
                     int year = format.hasYear
                             ? Integer.valueOf(groups.get(format.yearIndex))
-                            : LocalDate.now().getYear();
+                            : LocalDate.now(LocaleUtil.getUserTimeZone().toZoneId()).getYear();
                     int month = parseMonth(groups.get(format.monthIndex));
                     int day = Integer.valueOf(groups.get(format.dayIndex));
                     return new NumberEval(DateUtil.getExcelDate(LocalDate.of(year, month, day)));
@@ -124,9 +125,9 @@ public class DateValue extends Fixed1Arg
         }
 
 
-        String[] months = new DateFormatSymbols().getMonths();
+        String[] months = DateFormatSymbols.getInstance(LocaleUtil.getUserLocale()).getMonths();
         for (int month = 0; month < months.length; ++month) {
-            if (months[month].toLowerCase().startsWith(monthPart.toLowerCase())) {
+            if (months[month].toLowerCase(LocaleUtil.getUserLocale()).startsWith(monthPart.toLowerCase(LocaleUtil.getUserLocale()))) {
                 return month + 1;
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org