This file contains 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' | |
# | |
# 指定された日付が、その月において何週目にあたるのかを計算し、返却します。 | |
# | |
# 週始まりは月曜です。初週を 1 としています。 | |
# | |
def week_of_month(date) | |
first_week = (date - (date.day - 1)).cweek | |
this_week = date.cweek |