Created
January 30, 2014 13:54
-
-
Save itayadler/8708773 to your computer and use it in GitHub Desktop.
Ruby method for determining if the current time is during the jewish weekend
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
def jewish_weekend?(date=Time.now) | |
#Time.now.end_of_week will return sunday, so friday is -1 & saturday is -2 | |
end_of_week = date.end_of_week | |
friday = end_of_week - 2.day | |
saturday = end_of_week - 1.day | |
(date.day == friday.day) || (date.day == saturday.day) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment