Adds support for saturday as the first week day (#7097).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5228 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
3ef5daaf35
commit
78af4f429f
|
@ -854,6 +854,8 @@ module ApplicationHelper
|
|||
'Calendar._FD = 1;' # Monday
|
||||
when 7
|
||||
'Calendar._FD = 0;' # Sunday
|
||||
when 6
|
||||
'Calendar._FD = 6;' # Saturday
|
||||
else
|
||||
'' # use language
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<p><%= setting_select :default_language, lang_options_for_select(false) %></p>
|
||||
|
||||
<p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(7),'7']], :blank => :label_language_based %></p>
|
||||
<p><%= setting_select :start_of_week, [[day_name(1),'1'], [day_name(6),'6'], [day_name(7),'7']], :blank => :label_language_based %></p>
|
||||
|
||||
<p><%= setting_select :date_format, Setting::DATE_FORMATS.collect {|f| [Date.today.strftime(f), f]}, :blank => :label_language_based %></p>
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ module Redmine
|
|||
case Setting.start_of_week.to_i
|
||||
when 1
|
||||
@first_dow ||= (1 - 1)%7 + 1
|
||||
when 6
|
||||
@first_dow ||= (6 - 1)%7 + 1
|
||||
when 7
|
||||
@first_dow ||= (7 - 1)%7 + 1
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -40,4 +40,24 @@ class CalendarTest < ActiveSupport::TestCase
|
|||
c = Redmine::Helpers::Calendar.new(Date.today, :en, :week)
|
||||
assert_equal [7, 6], [c.startdt.cwday, c.enddt.cwday]
|
||||
end
|
||||
|
||||
def test_monthly_start_day
|
||||
[1, 6, 7].each do |day|
|
||||
with_settings :start_of_week => day do
|
||||
c = Redmine::Helpers::Calendar.new(Date.today, :en, :month)
|
||||
assert_equal day , c.startdt.cwday
|
||||
assert_equal (day + 5) % 7, c.enddt.cwday
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_weekly_start_day
|
||||
[1, 6, 7].each do |day|
|
||||
with_settings :start_of_week => day do
|
||||
c = Redmine::Helpers::Calendar.new(Date.today, :en, :week)
|
||||
assert_equal day, c.startdt.cwday
|
||||
assert_equal (day + 5) % 7 + 1, c.enddt.cwday
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue