Issue 3866 - Add-In: NETWORKDAYS accepts negative values as input
Summary: Add-In: NETWORKDAYS accepts negative values as input
Status: CLOSED WONT_FIX
Alias: None
Product: Calc
Classification: Application
Component: ui (show other issues)
Version: 614
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: daniel.rentz
QA Contact: issues@sc
URL:
Keywords:
: 4152 (view as issue list)
Depends on:
Blocks:
 
Reported: 2002-04-04 17:10 UTC by Unknown
Modified: 2013-08-07 15:12 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Unknown 2002-04-04 17:10:13 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.
Comment 1 peter.junge 2002-04-05 08:56:03 UTC
I'll have a look, Peter
Comment 2 ooo 2002-04-05 10:02:52 UTC
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.
Comment 3 ooo 2002-04-05 10:03:49 UTC
taking it
Comment 4 daniel.rentz 2002-04-22 11:49:46 UTC
*** Issue 4152 has been marked as a duplicate of this issue. ***
Comment 5 ooo 2002-12-09 14:50:39 UTC
Target to OOo 2.0
Comment 6 ooo 2003-09-29 11:19:42 UTC
Developer notes: later.
Comment 7 oc 2003-10-02 10:52:56 UTC
According to the OpenOffice.org roadmap
(http://tools.openoffice.org/releases) this issue was retargeted to
OOo Later.
Comment 8 jodygoldberg 2005-03-31 14:37:04 UTC
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.
Comment 9 ooo 2005-04-01 12:38:48 UTC
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.
Comment 10 daniel.rentz 2005-04-04 12:28:23 UTC
accepted
Comment 11 daniel.rentz 2005-04-04 14:09:22 UTC
title
Comment 12 daniel.rentz 2008-01-16 09:41:18 UTC
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
Comment 13 daniel.rentz 2008-01-16 09:47:05 UTC
hmmm ... checked in MS Excel, works there in the same way, so we should not
change it :-(
Comment 14 daniel.rentz 2008-01-16 10:06:20 UTC
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.
Comment 15 Mechtilde 2008-11-06 21:07:49 UTC
close the wontfix issue