#723: Calendar::roll() over year boundaries yields wrong results
---------------------+------------------------------------------------------
 Reporter:  dominik  |       Owner:  dominik           
     Type:  defect   |      Status:  new               
 Priority:  normal   |   Milestone:  1.0               
Component:  date     |     Version:  0.11.1RC1         
 Severity:  major    |    Keywords:  calendar date roll
Has_patch:  0        |  
---------------------+------------------------------------------------------

Comment(by david):

 To clarify the description: months, days, hours, minutes and seconds (and
 years of course) are zero-based, so 2007-11-30 is the 31st of december,
 2007 (the year is correct I think, I need to verify this)

 Rolling up seven days is supposed to yield december 6, that is correct.

 I also think the second example is correct. Rolling up by one week would
 result in... good question :p probably the same as seven days. Rolling up
 by one week '''of the year''' does something else:

 Rolling up by one week (we're in the last of the year) obviously goes back
 to the first week of the same year. {{{WEEK_OF_YEAR}}} likely refers to a
 calendar week, either by US definition or as defined in ISO 8601.
  US definition::
   The first calendar week of a year is the one containing Jan 1
  ISO 8601 definition::
   The first calendar week of a year is the one containing at least four
 days of that year

 Dec 31, 2007 was a Monday. January 1 was a Thursday. So the first week of
 January 2007 ranges from Mon, Dec 29, 2006 - Sun, Jan 4, 2007. There is no
 Monday in this week, so the date needs to be fixed to Thursday, Jan 1,
 because rolling a calendar does not change more significant (="bigger")
 fields (if it did, the year would probably reset back to 2006; utter
 nonsense).

 The verdict is: use {{{add()}}}, not {{{roll()}}}, like the docs say ;)

-- 
Ticket URL: <http://trac.agavi.bitxtender.net/ticket/723#comment:4>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5


_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to