This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "date" | |
# Days from day one to first saturday are result in index 1 | |
def week_index_in_month(date) | |
first_day_of_month = Date.new(date.year, date.month, 1) | |
((date.day + first_day_of_month.wday) / 7.0).ceil | |
end | |
# Days from day one to seven are result in index 1 | |
def week_index_in_month(date) |