Download it now!
Bug 101541 - WORKDAY.INTL function not working properly
Summary: WORKDAY.INTL function not working properly
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.3 all versions
Hardware: All All
: medium normal
Assignee: Winfried Donkers (retired)
URL:
Whiteboard: target:5.3.0 target:5.2.3 target:5.1.6
Keywords: implementationError
: 101833 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-08-15 12:34 UTC by Andrea Borsani
Modified: 2016-10-18 14:43 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Workday.Intl example (15.34 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-08-15 12:34 UTC, Andrea Borsani
Details
WORKDAY, WORKDAY.INTL example (15.27 KB, application/x-vnd.oasis.opendocument.spreadsheet)
2016-09-08 06:13 UTC, Winfried Donkers (retired)
Details
test document with comparison with Excel results (19.54 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-09-08 14:33 UTC, Winfried Donkers (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Borsani 2016-08-15 12:34:20 UTC
Created attachment 126844 [details]
Workday.Intl example

Dear LibreOffice Support Team,
   this is to inform you about a miscalculation of WORKDAY.INTL function because it returns an holiday date although a valid holidays range has been set.

To ensure about this unexpected behaviour, WORKDAY and WORKDAY.INTL functions has been compared
1) using same default weekend and holidays range:
2) calculating the same next workday
3) also on Google Drive

WORKDAY(<my date>,1,<my holidays range>)
WORKDAY.INTL(<my date>,1,1,<my holidays range>)

Thank you and best regards
Comment 1 Aron Budea 2016-08-15 23:35:56 UTC
Thank you for the bug report.
Reproduced with v5.2.0.4 and v4.0.0.3 (the function was introduced there).
Comment 2 Aron Budea 2016-09-02 03:17:55 UTC
*** Bug 101833 has been marked as a duplicate of this bug. ***
Comment 3 Aron Budea 2016-09-07 12:18:41 UTC
Setting easyHack tag, it's a simple fix.
The problem is if the period ends with a holiday right after weekend, it's disregarded.

Pointer:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=22dac22fe256b28b78c8e0783f2625aee0f75ace

Function: void ScInterpreter::ScWorkday_MS()
http://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr2.cxx

Adding raal, please update the test once it's fixed.
Comment 4 Winfried Donkers (retired) 2016-09-08 06:02:21 UTC
(In reply to Aron Budea from comment #3)
> Setting easyHack tag, it's a simple fix.
> The problem is if the period ends with a holiday right after weekend, it's
> disregarded.
> 

I'll fix it (as I didn't appear to implement it correctly in the first place).
Comment 5 Winfried Donkers (retired) 2016-09-08 06:13:57 UTC
Created attachment 127207 [details]
WORKDAY, WORKDAY.INTL example

Added the results from Excel for these function, showing that there are 4 different results instead of 2.
Comment 6 Winfried Donkers (retired) 2016-09-08 06:15:48 UTC
Comment on attachment 126844 [details]
Workday.Intl example

replaced by attachment 127207 [details]
Comment 7 jani 2016-09-08 07:45:02 UTC
This bug does not qualify as a easyHack, there are no code pointers and the keywords to not follow the standard.

Remark, easyHack keyword normally requires a core developer Or QA/UI team member have looked at the bug and made sure it is easy to solve.
Comment 8 Winfried Donkers (retired) 2016-09-08 14:33:00 UTC
Created attachment 127220 [details]
test document with comparison with Excel results

Document contains framework for tests with different days values, both negative and positive.
Tested document in Excel for some values of days; WORKDAY and WORKDAY.INTL produced the same results.
Comment 9 Aron Budea 2016-09-08 23:10:11 UTC
(In reply to jan iversen from comment #7)
> This bug does not qualify as a easyHack, there are no code pointers and the
> keywords to not follow the standard.
> 
> Remark, easyHack keyword normally requires a core developer Or QA/UI team
> member have looked at the bug and made sure it is easy to solve.

Jan, the code pointer was in comment 3, not sure what you meant by keywords, and I'm in the QA team. I also think this was a pretty easy task (producing an extensive test document isn't, though), but Winfried wanted to take care of it, and is processing it himself, and that's cool, too.

Thanks for picking it up, Winfried!
Comment 10 Xisco Faulí 2016-09-10 22:15:58 UTC
Hi Winfried,
Please, next time you assign a bug to yourself, remember to change the status and the assignee.
Regards
Comment 11 Winfried Donkers (retired) 2016-09-12 06:02:20 UTC
(In reply to Xisco Faulí from comment #10)
> Hi Winfried,
> Please, next time you assign a bug to yourself, remember to change the
> status and the assignee.
> Regards

Hi Xisco,
Thank you for correcting, I will try to remember next time ;-)
Comment 12 Commit Notification 2016-09-16 19:38:18 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "master":

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

tdf#101541 function WORKDAY.INTL not working properly

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 13 Eike Rathke 2016-09-16 19:50:24 UTC
@Raal:
Can you please add the test cases from the attachment and maybe those of bug 101833 as well to sc/qa/unit/data/functions/fods/workday.intl.fods
Thanks.
Comment 14 Commit Notification 2016-09-16 21:01:35 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

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

tdf#101541 function WORKDAY.INTL not working properly

It will be available in 5.2.3.

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 15 Commit Notification 2016-09-16 21:16:21 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3bf31803959ccc54bb949630f936a768ef47a90b&h=libreoffice-5-1

tdf#101541 function WORKDAY.INTL not working properly

It will be available in 5.1.6.

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.