Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Date.at_end_of_week is unpredictable

#423

Date.at_end_of_week does not work as demonstrated by the following examples:

The end of the week is supposed to be Saturday, the 21st.

now = Date.current.at_beginning_of_day
# => Sun Jun 15 00:00:00 -0500 2008
now.at_end_of_week
# => Sun Jun 15 23:59:59 -0500 2008

Adding on to the previous code, the end of the week should also be Saturday, the 21st.

tom = now.tomorrow 
# => Mon Jun 16 00:00:00 -0500 2008
tom.at_end_of_week
# => Sun Jun 22 23:59:59 -0500 2008

Reported by ronin-23439 (at lighthouseapp) · June 15th, 2008 @ 06:30 AM

State: wontfix
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Oscar Del Ben
    Oscar Del Ben

    This depends on where you live. I think it should be added as an option to put in config/environment.rb. I'll try to make a patch for this.

    June 15th, 2008 @ 09:34 AM

  2. Oscar Del Ben
    Oscar Del Ben

    I've seen that this convention is used in a lot of methods, so it's not easy to change.

    June 15th, 2008 @ 10:05 AM

  3. nikz
    nikz
    • Tag set to activesupport, bug, core_ext, date

    Hey there,

    This should be easy enough to override if you'd like the week to end on Saturday.

    In Ruby core, Sunday is "wday" 0, and Saturday is wday "6".

    I'm going to recommend this be closed up, unless you'd really like an option. :)

    August 7th, 2008 @ 10:46 AM

  4. josh
    josh
    • State changed from new to wontfix

    November 22nd, 2008 @ 07:48 PM