[Libreoffice-bugs] [Bug 143947] Function DATE yields wrong year if input is only "year"

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Aug 19 16:32:12 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=143947

--- Comment #6 from Uwe Auer <uwe at franke-auer.de> ---
(In reply to Roman Kuznetsov from comment #5)
> Eike, I don't think it's a bug, but if user doesn't enter any from mandatory
> arguments, then Calc should shows some error code. Could you take a look at
> it?

Let's break down:

1) Omitting parameters cause an error: Using =DATE(2006)result in Err:511
"Variable missing" as expected.
2) Using =DATE(2006;;) translates to =DATE(2006;0;0)and now we have OASIS
Standard (see [1]) stating:

Constraints: 1904 ≤ Year ≤ 9956; 1 ≤ Month ≤ 12; 1 ≤ Day ≤ 31; Evaluators may
evaluate expressions that do no meet this constraint ...  Month > 12 and Day >
days of Month will roll over the date, computing the result by adding months
and days as necessary. 

Now obviously evaluators decided to compute date backwards accordingly if Month
< 1 and Day < 1 (i.e. subtracting months and days as necessary).

Year    Month   Days    Date            Formula
2006    1       1       2006-01-01      =DATE(A2;B2;C2)
2006    0       1       2005-12-01      =DATE(A3;B3;C3)
2006    -1      1       2005-11-01      =DATE(A4;B4;C4)
2006    -2      1       2005-10-01      =DATE(A5;B5;C5)
2006    -3      1       2005-09-01      =DATE(A6;B6;C6)
2006    -4      1       2005-08-01      =DATE(A7;B7;C7)
2006    -5      1       2005-07-01      =DATE(A8;B8;C8)
2006    -6      1       2005-06-01      =DATE(A9;B9;C9)
2006    -7      1       2005-05-01      =DATE(A10;B10;C10)
2006    -8      1       2005-04-01      =DATE(A11;B11;C11)
2006    -9      1       2005-03-01      =DATE(A12;B12;C12)
2006    1       0       2005-12-31      =DATE(A13;B13;C13)
2006    1       -1      2005-12-30      =DATE(A14;B14;C14)
2006    1       -2      2005-12-29      =DATE(A15;B15;C15)
2006    1       -3      2005-12-28      =DATE(A16;B16;C16)
2006    1       -4      2005-12-27      =DATE(A17;B17;C17)
2006    1       -5      2005-12-26      =DATE(A18;B18;C18)
2006    1       -6      2005-12-25      =DATE(A19;B19;C19)
2006    1       -7      2005-12-24      =DATE(A20;B20;C20)
2006    1       -8      2005-12-23      =DATE(A21;B21;C21)
2006    1       -9      2005-12-22      =DATE(A22;B22;C22)
2006    1       -10     2005-12-21      =DATE(A23;B23;C23)

1) Don't see a bug here
2) Don't see a violation of the standard, but an allowed interpretation what to
evaluate in case of a constraint is not met
3) There is an error in case missing argugemt
4) The only thing to dispute may be, whether implicit translation of
=DATE(2006;;) into =DATE(2006;0;0)is covered by the standard.


[1] OpenDocument-v1.3 - 6.10.2 DATE
https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1018174_715980110

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210819/8dcac75e/attachment.htm>


More information about the Libreoffice-bugs mailing list