Skip to content

Instantly share code, notes, and snippets.

@hara-y-u
Last active July 10, 2024 15:22
Show Gist options
  • Save hara-y-u/7c843aba2363aea4391d35931c6f6731 to your computer and use it in GitHub Desktop.
Save hara-y-u/7c843aba2363aea4391d35931c6f6731 to your computer and use it in GitHub Desktop.
Ruby Script to find week index in month. / 日付がその月の第何週目かを調べるRuby Script
# If you look at each month on calendar, you will notice 1-7days are on the first week and same for the rest.
# Therefore, the following formula holds.
# ISO8601 is not supported
(date.day - 1) / 7 + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment