DATEDIF function doesn't work correctly with leap years

Hi, I found a bug in the DATEDIF(date1;date2;“YD”) function.
In the attached excel file there are 2 lines with 2 dates:

A               B                DATEDIF(A;B;"YD")
11.10.2010      01.03.2011       141
11.10.2010      01.03.2012       142

because 2012 is a leap year, then for the second row the result is more by 1
In Aspose.Cells for both cases returns 141 (6.4 KB)


We will evaluate your mentioned issue and get back to you soon.


Thanks for the template file and details.

Please notice, I am able to reproduce the issue as you mentioned by using your sample file. I found that DATEDIF function doesn’t work correctly with leap years. I used the following sample code with your sample file:
Sample code:

Workbook workbook = new Workbook("f:\\files\\test.xlsx");
System.out.println(workbook.getWorksheets().get(0).getCells().get("C2").getValue());//141 - Not Ok

I have logged a ticket with an id “CELLSJAVA-45035” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.


We are pleased to inform you that your issue has been resolved now. The fix will be included in our upcoming release (Aspose.Cells v23.1) which is scheduled in the second week of January 2023. You will be notified once the next release is published.

The issues you have found earlier (filed as CELLSJAVA-45035) have been fixed in Aspose.Cells for Java 23.1.