Bug 144239 - =DAYS360(A58,NOW())
Summary: =DAYS360(A58,NOW())
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-01 11:50 UTC by Francisco Dario
Modified: 2021-09-02 12:40 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample Document (7.64 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-09-01 13:10 UTC, Michael Warner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francisco Dario 2021-09-01 11:50:45 UTC
Description:
=DAYS360(A58,NOW())

Agost 31 not exist

Steps to Reproduce:
1.=DAYS360(A58,NOW())
2.now is Agost 31
3. A58 = 9/01

Expected Results:
-1


Reproducible: Always


User Profile Reset: No



Additional Info:
LibreOfficeCalc
Comment 1 Michael Warner 2021-09-01 13:10:48 UTC
Created attachment 174699 [details]
Sample Document

This document shows DAYS360 returning the same value for both August 30 and August 31.
Comment 2 Michael Warner 2021-09-01 13:12:03 UTC
Version: 7.2.0.4 (x64) / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 6; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 3 Eike Rathke 2021-09-01 17:24:45 UTC
This is correct and not a bug. DAYS360() "Returns the difference between two dates based on the 360 day year", see
https://help.libreoffice.org/latest/en-GB/text/scalc/01/func_days360.html
and
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#DAYS360
for the algorithms.

For the example in the report with US-NASD algorithm we have
(2021*360=727560 + 8*30=240 + 31) = 727831
-
(2021*360=727560 + 9*30=270 +  1) = 727831
= 0


(In reply to Michael Warner from comment #1)
> This document shows DAYS360 returning the same value for both August 30 and
> August 31.
Yes, though that document tests a different, European, algorithm (3rd argument !=0, note also there's no difference between 1 or 2, it's a logical parameter, either 0 or not 0). Result is different in this case.

For 2021-08-31 start date day is changed to 30.
Then for both we have
(2021*360=727560 + 9*30=270 +  1) = 727831
-
(2021*360=727560 + 8*30=240 + 30) = 727830
= 1

Please also don't use text arguments for numeric parameters, result depends on settings (i.e. I get #VALUE! errors for all because I use the strictest setting). In this case use the DATE() function instead. Yes, the help is bad on that.
Comment 4 Michael Warner 2021-09-02 12:40:11 UTC
I see. Thanks for this detailed response, Eike. :-)