Created
October 10, 2014 19:53
-
-
Save nhocki/e865baa10a6d98cf3726 to your computer and use it in GitHub Desktop.
Disable something if not on a specific time-frame // day
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 office_hours? | |
Time.use_zone('Pacific Time (US & Canada)') do | |
# window = Time.zone.parse("2014-04-30") | |
now = Time.zone.now | |
start, finish = Time.zone.parse('9:30'), Time.zone.parse('16:30') | |
now.between?(start, finish) # && now.yday == window.yday | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment