| Summary: | Abnormal return value of getDuration() from Plan class | ||
|---|---|---|---|
| Product: | Group 3 | Reporter: | Xavier.edith.lee |
| Component: | Personal Finance Mangement | Assignee: | Hsu To-Liang <tlhsu2-c> |
| Status: | CONFIRMED --- | ||
| Severity: | critical | CC: | Xavier.edith.lee |
| Priority: | --- | ||
| Version: | unspecified | ||
| Hardware: | PC | ||
| OS: | Mac OS | ||
| Attachments: | Bug reproduced and located in Plan class as suggested | ||
|
Description
Xavier.edith.lee
2020-11-22 17:45:47 HKT
Created attachment 49 [details]
Bug reproduced and located in Plan class as suggested
The result after unit testing was indeed caused by the aforementioned function getDuration(). It is suspected that the fault arose from the use of Period class to calculate date difference.
As discussion from online forum revealed, Period class returns date difference separately in terms of [year, month, day]. Suppose dateDifference = 93 days. Period.getDays() will return 3 days since it is [0 year, 3 months, 3 days].
Alternative method is suggested to replace such erroneous function.
After switching to DAYS.between(startDate, endDate) from ChronoUnit Class. The computation was corrected. |