[Rails] Re: Very simple Date math goes randomly bonkers

2008-12-08 Thread Philip Hallstrom
On Dec 8, 2008, at 10:55 AM, Matt Darby wrote: I have a timesheet in my app that simply displays the week range based on a passed in date (params[:date]). The view iterates through the Date::ABBR_DAYNAMES and shows a link to the corresponding date. What do you pass to

[Rails] Re: Very simple Date math goes randomly bonkers

2008-12-08 Thread Matt Darby
What do you pass to get_work_week_date_range?  Is it a string?  Or an   instance of Date?  Or Time? I pull the date in from the params hash, and immediately parse it to a Date: Date.parse(params[:date]) rescue Date.today If it worked once it should always work.  Which suggests that maybe  

[Rails] Re: Very simple Date math goes randomly bonkers

2008-12-08 Thread Frederick Cheung
On Dec 8, 6:55 pm, Matt Darby [EMAIL PROTECTED] wrote: 2008-12-08.monday = 2008-12-08 2008-12-08-1.day = 2008-12-07 2008-12-08.end_of_week = 2008-12-14 2008-12-14-1.day = 2008-12-13 2008-12-08 == [2008-12-07, 2008-12-13] ... n times later ... 2008-12-08.monday = 2008-12-08

[Rails] Re: Very simple Date math goes randomly bonkers

2008-12-08 Thread Matt Darby
Perhaps the key thing to note is that 1772-05-19 is about 236 years and 7 months ago, which (get your calculators out) is about 86400, ie the number of seconds in a day. Whereas on an instance of Time, +/- 1 means +/- 1 second, on instances of Date/DateTime +/- means +/- 1 second. That is I

[Rails] Re: Very simple Date math goes randomly bonkers

2008-12-08 Thread Matt Darby
It was the facets/time library. It was loaded in a totally separate part of the app, in a method that had not much to do with anything. Thanks again Frederick; that one got your a WWR recommendation ;) --~--~-~--~~~---~--~~ You received this message because you