Changing the first day of week in rails

Viewed 17394

I and trying to build a calendar in ruby on rails.

In ruby-on-rails, monday is considered to be the first day of the week, but i have to set sunday as the first. I intend to change this to properly use the date's built-in methods RoR. Assuming today is sunday, oct 24th. Look the example:

Date.now.beginning_of_week

it prints: 2010-10-18 ;but if i could set sunday as the first of the week, it should print : 2010-10-24

7 Answers

Add this config to config/application.rb

config.beginning_of_week = :sunday
Related