Bug 100396 - WEEKDAY function - second parameter not checked
Summary: WEEKDAY function - second parameter not checked
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:5.3.0 target:5.2.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-15 09:51 UTC by raal
Modified: 2016-10-25 18:54 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description raal 2016-06-15 09:51:35 UTC
https://help.libreoffice.org/Calc/WEEKDAY
 weekday function is defined as:  Returns the day of the week for the given
date value. The day is returned as an integer between 1 (Sunday) and 7
(Saturday) if no type or type=1 is specified.


But formula  =WEEKDAY(K9;0)   works, parameter type=0. Calc it use like =
WEEKDAY(K9;). Calc should trigger error.

Also =WEEKDAY(K9;999999) is accepted.
Comment 1 Eike Rathke 2016-06-15 10:25:42 UTC
Also, Excel2010 added additional type parameters, see https://support.office.com/en-US/article/WEEKDAY-function-60E44483-2ED1-439F-8BD0-E404C190949A
Comment 2 Commit Notification 2016-06-15 10:48:43 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d9911e0d13c96feb0b0d1feacef6be7be29ccfe1

Resolves: tdf#100396 handle unspecified WEEKDAY arguments and support new ones

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Commit Notification 2016-06-15 10:59:01 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=be710eef2f8e408b38d8a90aee5c45e2d1a936a2&h=libreoffice-5-2

Resolves: tdf#100396 handle unspecified WEEKDAY arguments and support new ones

It will be available in 5.2.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Eike Rathke 2016-06-15 11:02:47 UTC
Note: any type argument other than the specified omitted (=1) or 1 or 2 or 3 was handled the same as 3, Monday=0
Documents that used such unspecified values will calculate differently and for 11,12,13,14,15,16,17 return the new Excel compatible weekday numbers, for other unspecified type argument values an error is returned.
Comment 5 raal 2016-06-18 18:43:42 UTC
Thanks, verified
Version: 5.3.0.0.alpha0+
Build ID: 131e604073f89e6c1dd54be88b94b7befd881f2e
CPU Threads: 4; OS Version: Linux 4.4; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-06-17_22:53:28