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

Age in month and year are not equivalent to fixed-day interval #140

Open
hugy718 opened this issue Jun 8, 2023 · 0 comments
Open

Age in month and year are not equivalent to fixed-day interval #140

hugy718 opened this issue Jun 8, 2023 · 0 comments
Assignees
Labels
logic-issue problems about the main logic

Comments

@hugy718
Copy link
Collaborator

hugy718 commented Jun 8, 2023

Problem

The current age calculation for week/month/year is based on translation to the fixed day interval:

case MONTH:
return new TimeWindow(d.toDays() / 30, TimeUtils.TimeUnit.MONTH);
case WEEK:
return new TimeWindow(d.toDays() / 7, TimeUtils.TimeUnit.WEEK);
case YEAR:
return new TimeWindow(d.toDays() / 365, TimeUtils.TimeUnit.YEAR);

Needs to use the date object to generate the difference directly and add tests to cover these cases.

This is related to issue #134, PR #135

@hugy718 hugy718 changed the title Age in month and year are not equivalent to fix-day interval Age in month and year are not equivalent to fixed-day interval Jun 8, 2023
@hugy718 hugy718 self-assigned this Jun 8, 2023
@hugy718 hugy718 added the logic-issue problems about the main logic label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logic-issue problems about the main logic
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant