summaryrefslogtreecommitdiffstats
path: root/external/jfreereport/patches/libformula-datevalue_truncation.patch.1
blob: 069c667c19ac9f52c710320a21036fe7399e07c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff -ur jfreereport_libformula.org/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java jfreereport_libformula/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java
--- jfreereport_libformula.org/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java	2010-06-01 17:15:50.000000000 +0200
+++ jfreereport_libformula/source/org/pentaho/reporting/libraries/formula/function/datetime/DateValueFunction.java	2015-07-14 17:24:42.503895240 +0200
@@ -18,6 +18,7 @@
 package org.pentaho.reporting.libraries.formula.function.datetime;
 
 import java.util.Date;
+import java.util.Calendar;
 
 import org.pentaho.reporting.libraries.formula.EvaluationException;
 import org.pentaho.reporting.libraries.formula.FormulaContext;
@@ -28,6 +29,7 @@
 import org.pentaho.reporting.libraries.formula.typing.Type;
 import org.pentaho.reporting.libraries.formula.typing.TypeRegistry;
 import org.pentaho.reporting.libraries.formula.typing.coretypes.DateTimeType;
+import org.pentaho.reporting.libraries.formula.util.DateUtil;
 
 /**
  * This function returns
@@ -61,7 +63,8 @@
     final Object value = parameters.getValue(0);
 
     final Date date1 = typeRegistry.convertToDate(type, value);
-    return new TypeValuePair(DateTimeType.DATE_TYPE, date1);
+    final Date date  = DateUtil.normalizeDate(date1, DateTimeType.DATE_TYPE);
 
+    return new TypeValuePair(DateTimeType.DATE_TYPE, date);
   }
 }