commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31602] - [lang] DateUtils should be able to adjust for weekends, etc.
Date Wed, 13 Oct 2004 21:59:47 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31602>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31602

[lang] DateUtils should be able to adjust for weekends, etc.





------- Additional Comments From scolebourne@joda.org  2004-10-13 21:59 -------
This patch suffers from a problem that the public int[] can be modified by 
anyone. (This is a Java design flaw - the language should support immutable 
arrays.)

One solution might be to design an inner class that represents a time type (eg. 
days and a list of values). That way you could define an object to 
exclude/include a range of months or hours as well as days. However, I can 
quickly see the scope growing greatly.

Thus I'm tempted to go back to a simpler more focussed approach:
- isWeekend(date) (Sat/Sun)
- isDayOfWeek(date, int[] daysOfWeek)
- addDaysIgnoreWeekend(date, amount)
- addDaysIgnoreDays(date, amount, int[] ignoreDays)
That way the most common case is clear, the international case can be handled, 
and the sat/sun constant is not exposed.

Also, all methods must be for both Date and Calendar. And the Date ones must 
use Calendar.getInstance() to get the Calendar object.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message