-
Notifications
You must be signed in to change notification settings - Fork 2
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
Provide LocalDate
interpolator
#446
Conversation
cc097ea
to
952797f
Compare
private val range = stop.toEpochDays() - start.toEpochDays() | ||
|
||
override fun interpolate(fraction: Float): LocalDate = | ||
start + DatePeriod(days = (range * fraction).roundToInt()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if roundToInt
(vs. just toInt
) is the best approach here?
Note
I tried using toInt
, and 2 (of the 3) LinearLocalDateInterpolator
tests (in this PR) failed, so I think roundToInt
is the correct approach.
23e4630
to
b1e5a6e
Compare
b1e5a6e
to
2284488
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rounding should be fine. Going from continuous (float) to discrete (local date) is always a little funky.
No description provided.