mbeddr.core icon indicating copy to clipboard operation
mbeddr.core copied to clipboard

Requirement module is showing wrong time, when the difference between current time and created time crosses months

Open Nandha1712 opened this issue 8 years ago • 0 comments

Create a Requirement module and a requirement in it. Right click the Requirement -> Show Reflective editor and change the created at field as 1452928596359 . (Which is Jan 16 , 2016) . Press F5. The difference is shown as (71 months ago) while the actual difference is only 26 months. On first level analysis, it is seen that TimeHelper.asReadableDeltaString() method's final return statement is return (delta / (MONTHS * WEEKS * DAYS * HOURS * MINUTES * SECONDS)) + " months ago";

There is no need for WEEKS in the above statement, because the field MONTHS is defined in terms of days and not weeks. private static final int MONTHS = 30; P.S : The expression in denominator is full of int s, the result of denominator might cross the limit of int type, which also might result in incorrect value.

Nandha1712 avatar Mar 29 '18 06:03 Nandha1712