Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Small calendar issue

Moderators: kris

Posted: 10/04/08 06:57:31

I know this may not be very important, but while implementing a new calendar I noticed the tango.time.chrono.Gregorian method addMonths() produced what appears to be a bug: Pass in a date of say Jan 31 (any year/era) and add 1 month. It throws an exception "days out of range" because the code is trying to create a time value for the date Feb 31, which of course doesn't exist.

Example code: auto cal = Gregorian.generic; Time t = cal.addMonths(cal.toTime(Date(0,31,1,1,1,1)), 1);

I don't know what the intended behavior should be (perhaps bound the days after determining the new month), but I'd imagine an exception was not expected.

Author Message

Posted: 10/04/08 08:24:28

Thanks for posting -- http://www.dsource.org/projects/tango/ticket/1312