[
https://issues.apache.org/jira/browse/OFBIZ-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562771#action_12562771
]
Jacques Le Roux commented on OFBIZ-715:
---------------------------------------
Adrian,
I have tested ElapsedTime and the problem is not only related to leap years.
The problem arises as soon you ask for the same month with a lesser day in
another year. For instance if you ask for
begin : 2008-03-03
end : 2009-03-01
you get : 1 year and 29 days which is obviously false. I did not find other
issues so far.
So I think you should not only test if the month is the same but also if the
year is the same.
I began to try with
if (calStart.get(Calendar.MONTH) == targetMonth
&& calStart.get(Calendar.YEAR) == targetYear) {
but other problems arises (negative months and anyway the number of days is
still false) and I quickly gave up.
I suppose you had a look at
http://www.javaworld.com/javaworld/jw-03-2001/jw-0330-time.html?page=2.
I found also http://www.developpez.net/forums/archive/index.php/t-207340.html
(look at bottom, it's a derivative work of previous).
Your algorithm seems smart and I will give it another try if you don't beat me
at it... (Like David said "Sounds like fun..." ;o)
> Utils for doing date calculations based on timeUomIds
> -----------------------------------------------------
>
> Key: OFBIZ-715
> URL: https://issues.apache.org/jira/browse/OFBIZ-715
> Project: OFBiz
> Issue Type: Improvement
> Components: framework
> Reporter: Andrew Sykes
> Assignee: Jacques Le Roux
> Priority: Minor
> Attachments: elapsed_time.patch, UtilDateTime.java.patch,
> UtilDateTime.java.patch
>
>
> 6 new methods,
> 1/ adjustDateTime (3 methods) adjusts either a Timestamp Date or Calendar by
> the given timeUomId and timeUomMultiple
> 2/ getTimeUomMultipleDifference (3 methods) gets the timeUomMultiple for two
> Timestamp Date or Calendar objects given the timeUomId.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.