Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Nandha1712 opened this issue Mar 29, 2018 · 0 comments
Assignees

Comments

@Nandha1712
Copy link

Nandha1712 commented Mar 29, 2018

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.

@krishnanm86 krishnanm86 self-assigned this Apr 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants