If you have an array of
Date() objects and you want to find the middle one, what do you do?
- If you have an odd number of objects, just take the middle one
- If you have an even number, you would normally do the mean of the middle two. But mathematical operations aren’t defined for dates, nor should they be, so you can’t do that.
Returning an array of the middle two also sounds like odd behavior, since it leads to type instability. At the same time, it seems reasonable to want the middle(ish) value of an array of dates.
Are there any standard practices for dealing with this?