Created
September 29, 2025 02:51
-
-
Save Davis-3450/d2127e3a3ddc5d56224a708dcb4c80c1 to your computer and use it in GitHub Desktop.
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
| class WorkHour(int, Enum): | |
| WORK_START = 8 | |
| LUNCH_START = 12 | |
| LUNCH_END = 13 | |
| WORK_END = 17 | |
| def is_working_hour(self) -> bool: | |
| t = date.time() | |
| morning_ok = time(WorkHour.WORK_START.value, 0) <= t < time(WorkHour.LUNCH_START.value, 0) | |
| afternoon_ok = time(WorkHour.LUNCH_END.value, 0) <= t < time(WorkHour.WORK_END.value, 0) | |
| return morning_ok or afternoon_ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment