BACKPORT: Calendar.Week object displays an incorrect date the first week of the year where the week starts in december the previous year.
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=3518
Reported by Erik Dahl erikd@roxen.com
This is how you trigger it in Pike 7.4 and 7.2:
Pike v7.4 release 10 running Hilfe v3.5 (Incremental Pike Frontend)
> object t = Calendar.Week(Calendar.parse("%Y-%M-%D","2003-01-01"));
> t;
(1) Result: Week(w1 2003)
> t->format_ymd();
(2) Result: "2003-01--1"
> t->month_day();
(3) Result: -1
> object t = Calendar.Week(Calendar.parse("%Y-%M-%D","2003-01-14"));
> t->format_ymd();
(4) Result: "2003-01-13"
Pike v7.2 release 433 running Hilfe v2.0 (Incremental Pike Frontend)
> object t = Calendar.Week(Calendar.parse("%Y-%M-%D","2003-01-01"));
Result: Week(w1 2003)
> t->format_ymd();
Result: "2003-01--1"
> t->month_day();
Result: -1
> Calendar.Week(Calendar.parse("%Y-%M-%D","2001-01-01"))->format_ymd();
Result: "2001-01-01"
>Calendar.Gregorian.Week(Calendar.Gregorian.parse("%Y-%M-%D","2001-01-01"))->format_ymd();
Result: "2001-01-00"
An important note: Calendar module is amazingly good!