# Return the first day of week
# 1 = Monday ... 7 = Sunday
def first_wday
- @first_dow ||= (l(:general_first_day_of_week).to_i - 1)%7 + 1
+ case Setting.start_of_week.to_i
+ when 1
+ @first_dow ||= (1 - 1)%7 + 1
+ when 7
+ @first_dow ||= (7 - 1)%7 + 1
+ else
+ @first_dow ||= (l(:general_first_day_of_week).to_i - 1)%7 + 1
+ end
end
def last_wday