Apache OpenOffice (AOO) Bugzilla – Issue 3866
Add-In: NETWORKDAYS accepts negative values as input
Last modified: 2013-08-07 15:12:27 UTC
The function NETWORKDAYS (Start date;End date;holidays) doesn't work as expected when negative dates are given as parameters.The function should give an error that it cannot accept negative dates because dates cannot have negative values but the function outputs a value. For example,when -12.1.2002,-12.26.2002 and -12.24.2002 are given as parameters to the function,the functions outputs a value of -19,instead of giving an error message.
I'll have a look, Peter
This is not a problem of the NETWORKDAYS() function but a general formula parsing issue. In fact one can enter a negative date anywhere in a formula, like =1.1.2000- 1.1.1999 gives you the number of days in the year 1999. The NETWORKDAYS() function just takes the internal serial date number as parameters, like many other date funtions do. It could be considered to throw an error in the formula compiler if a unary '-' operator is encountered followed by a date value.
taking it
*** Issue 4152 has been marked as a duplicate of this issue. ***
Target to OOo 2.0
Developer notes: later.
According to the OpenOffice.org roadmap (http://tools.openoffice.org/releases) this issue was retargeted to OOo Later.
re: "er Fri Apr 5 02:02:52 -0800 2002" Actually I think the reverse is true. It is a bug in NETWORKDAYS. That function needs to validate it's inputs, including the date serials. Checking for a negative sign is incorrect. eg if A1=-10, then passing -A1 is correct. It's up to the function to handle things.
Both is/was true. A negative date like -1.2.3 entered directly in the formula (note that I'm not speaking of something like -A1 here) should be detected by the compiler, and functions like NETWORKDAYS() should of course evaluate their arguments for plausibility. However, being able to directly enter dates in a formula vanished anyway, and as soon as we will implement array constants it will be mandatory to not accept unquoted days because of the delimiter mess. Reassigning issue to Daniel, for he is the maintainer of the AddIn functions that should take care of their parameters.
accepted
title
we can ignore negative dates here, seems that this issue is just about checking that start date is less than end date, e.g. =NETWORKDAYS( DATE(2008;01;08); DATE(2008;01;01) ) results in -6 instead of an error
hmmm ... checked in MS Excel, works there in the same way, so we should not change it :-(
we will continue to accept negative serials for dates, which are accepted in all Calc functions. Something like "-12.1.2002" or "-DATE(2002;12;1)" results in the serial -37591 which means "37591 days before the null date 1899-Dec-30", thus is the valid date 1797-Jan-27.
close the wontfix issue