[ 
https://issues.apache.org/jira/browse/OFBIZ-715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586163#action_12586163
 ] 

Valentina Sirkova commented on OFBIZ-715:
-----------------------------------------

Hi Adrian - thanks a lot for answering,

Yes I reviewed your ElapsedTime patch and of course totally agree we should use 
java Calendar class and loop approach for solving the issue.
My question was slightly different. When we use Calendar`s "add" methods for 
adding years,months etc. we might have the following situation-calculate the 
years, months and days between: 2000-02-29 and 2004-02-29.
Using the callendar`s add method for calculating the year for example you would 
get 4 years and 1 day because doing calStart.add(Calendar.YEAR, 1) would give :
 - 2001-Feb-28(because Feb 29 does not exist!)
 - 2002-Feb-28
 - 2003-Feb-28
 - 2004-Feb-28
So I wonder if this is correct because I think the elapsed time is 4 years and 
NOT 4 years and 1 day. ?And if it really is 4 years for such period 29Feb-29Feb 
AND we assume the difference between 29Feb-28Feb is ONE year (as you say in 
your previous comment) then wouldn`t that mean that when we have the Leap day 
in ANY of our start and end dates we would always have a whole year?
This would be exactly 3 cases: 29Feb-29Feb, 29Feb-28Feb, 28Feb-29Feb
If we think of these periods as days elapsed this should be true as year could 
be 366 and 365 days...but I am not sure and need your advice..

Thanks: Valentina :) 

> 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.

Reply via email to