Bug 100342 - Formula NETWORKDAYS do not use OASIS order for Work days (4th parameter)
Summary: Formula NETWORKDAYS do not use OASIS order for Work days (4th parameter)
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.3.2 release
Hardware: All All
: medium normal
Assignee: Winfried Donkers
URL:
Whiteboard: target:5.3.0 target:5.2.0.1 target:5.1.5
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-12 12:40 UTC by pierre-yves samyn
Modified: 2023-03-07 14:58 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
NETWORKDAYS.ods (13.35 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-06-12 12:40 UTC, pierre-yves samyn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pierre-yves samyn 2016-06-12 12:40:47 UTC
Created attachment 125612 [details]
NETWORKDAYS.ods

Hi

(In reply to Commit Notification from bug 77985 comment #6)
> Winfried Donkers committed a patch related to this issue.
> fdo#77985 make calc function NETWORKDAYS comply with ODFF1.2

Thank you for working on this.

The ODFF1.2 states(*): 

"optional 4th parameter Workdays ... which days of the week ... in order Sunday, Monday,...,Saturday. So, the default definition of the work week excludes Saturday and Sunday and is: {1;0;0;0;0;0;1}"

I may be wrong but it seems you use Monday, Tuesday,...,Sunday order.

Steps to reproduce: open the NETWORKDAYS.ods attached
- In C11 the result is not correct using {1;0;0;0;0;0;1}
- In E11 the result is correct using {0;0;0;0;0;1;1}

Platform: Windows 7/64 & Version: 5.1.3.2
Build ID: 644e4637d1d8544fd9f56425bd6cec110e49301b
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
Locale: fr-FR (fr_FR)

(*) http://docs.oasis-open.org/office/v1.2/cos01/OpenDocument-v1.2-cos01-part2.html#__RefHeading__1018198_715980110

Regards
Comment 1 m_a_riosv 2016-06-12 14:23:08 UTC
Reproducible.
Win10x64
Version: 5.1.4.1 (x64)
Build ID: a4d48e4ff0e9f93e78b6356ca7b0b6303e360356
CPU Threads: 4; OS Version: Windows 6.19; UI Render: GL; 

Changing the locale for cells or LibreOffice to English US doesn't help.
Comment 2 GerardF 2016-06-12 15:59:45 UTC
It is the world upside down :
Excel pushing ISO standard and ODF (OASIS) american standard...

For NETWORDAYS.INTL, Excel help says :
"Weekend string values are seven characters long and each character in the string represents a day of the week, starting with Monday. 1 represents a non-workday and 0 represents a workday. Only the characters 1 and 0 are permitted in the string. Using 1111111 will always return 0.

For example, 0000011 would result in a weekend that is Saturday and Sunday."

Should we provide a NETWORKDAYS function with week beginning on Sunday and NETWORKDAYS.INTL with week starting on Monday ?

Confusing...
Comment 3 pierre-yves samyn 2016-06-13 15:32:59 UTC
Hi 

(In reply to GerardF from comment #2)
> It is the world upside down :
> Excel pushing ISO standard and ODF (OASIS) american standard...

:)

> Should we provide a NETWORKDAYS function with week beginning on Sunday and
> NETWORKDAYS.INTL with week starting on Monday ?

The current functionning is ok for me (monday, tuesday... order). My concern is: 
I started documentation. Should I wait, is this a bug, and it will be modified, or it is deliberate (for consistency with other functions as you marked).

The change was not documented in the release notes but refers to OASIS, we can not know...

Regards
Pierre-Yves
Comment 4 Winfried Donkers 2016-06-14 09:07:00 UTC
As NETWORKDAYS should fully comply with ODF1.2 and currently it doesn't, I will fix this.
Comment 5 Commit Notification 2016-06-14 14:37:06 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "master":

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

tdf#100342 fix order of weekdays in NETWORKDAYS

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 6 Commit Notification 2016-06-14 16:09:16 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=2c9f14bd4bb764d61ca672bd1d64af2f28fb5dd6&h=libreoffice-5-2

tdf#100342 fix order of weekdays in NETWORKDAYS

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 7 Commit Notification 2016-06-14 16:09:22 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=641dfede9749dcc054b185bd72b227c0a1c093df&h=libreoffice-5-1

tdf#100342 fix order of weekdays in NETWORKDAYS

It will be available in 5.1.5.

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 8 raal 2016-06-18 19:57:36 UTC
Thanks for fixing. Verified.
Comment 9 pierre-yves samyn 2016-10-21 09:58:25 UTC
Hi

Verified on windows 7/64 & Version: 5.3.0.0.alpha1+
Build ID: 8a796410ec8f440b4163b15b928347c499da7a8f
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-10-20_23:07:21
Locale: fr-FR (fr_FR); Calc: group

Thank you 
Regards
Pierre-Yves
Comment 10 Xisco Faulí 2023-03-07 14:58:48 UTC
This is already covered in sc/qa/unit/data/functions/date_time/fods/networkdays.fods