On Saturday, 28 December 2013 at 13:58:40 UTC, Jakob Ovrum wrote:
On Saturday, 28 December 2013 at 12:16:32 UTC, Joseph Rushton
Wakeling wrote:
Are you sure that's going to work if the iota covers a leap
year? :-)
How would it fail? std.datetime does a good job with leap years
AFAIK.
Yes it does, the catch is:
2012, Jan, 1 + "365 days") = 2012, Dec, 31
because 2012 is a leap year. If you compute "back = end -
duration", you are asserting the user will always enter correct
bounds. This is fine for trivial intervals, but iota won't be
usable anywhere else.
It's always the same "issue": you have to compute the last
element inside iota, you should never rely on the user giving you
ideal inputs.