This project is archived and is in readonly mode.

#423 ✓wontfix
ronin-23439 (at lighthouseapp)

Date.at_end_of_week is unpredictable

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

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
# => 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
# => Sun Jun 22 23:59:59 -0500 2008

Comments and changes to this ticket

  • Oscar Del Ben

    Oscar Del Ben June 15th, 2008 @ 09:34 AM

    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.

  • Oscar Del Ben

    Oscar Del Ben June 15th, 2008 @ 10:05 AM

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

  • nikz

    nikz August 7th, 2008 @ 10:46 AM

    • 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. :)

  • josh

    josh November 22nd, 2008 @ 07:48 PM

    • State changed from “new” to “wontfix”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>