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

Fix time_duration formatting #40068

Merged
merged 1 commit into from
May 2, 2020

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Fix time duration formatting for periods in excess of 1 week"

Purpose of change

For time_durations in excess of 1 week, the formatting code would do the wrong thing. It tried to format two units worth of time (e.g. 1 week and 2 days) but the second unit could never be larger than hours.

Describe the solution

Add more cases to the code; now it can be anything up to seasons.

Describe alternatives you've considered

Arguably it would be better to say e.g. "1 hour and 0 minutes" than "1 hour and 3 seconds", but I don't want to change that now.

Testing

Added some unit tests.

Additional context

Discovered while working on achievements features.

For time_durations in excess of 1 week, the formatting code would do the
wrong thing.  It tried to format two units worth of time (e.g. 1 week
and 2 days) but the second unit could never be larger than hours.  Now
it can be anything up to seasons.
Copy link
Contributor

@ifreund ifreund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ifreund ifreund merged commit 0d2a3d9 into CleverRaven:master May 2, 2020
@jbytheway jbytheway deleted the time_duration_formatting branch May 2, 2020 10:47
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

Successfully merging this pull request may close these issues.

2 participants