https://github.com/vacovsky/timewindow
a little helper to check if the current time is between two other times
https://github.com/vacovsky/timewindow
Last synced: about 1 year ago
JSON representation
a little helper to check if the current time is between two other times
- Host: GitHub
- URL: https://github.com/vacovsky/timewindow
- Owner: vacovsky
- License: mit
- Created: 2018-05-02T18:29:37.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-13T18:24:50.000Z (about 8 years ago)
- Last Synced: 2025-01-30T23:48:35.841Z (over 1 year ago)
- Language: Go
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# timewindow
A little module to do time comparisons for detecting if a Go time struct is between two other times of day.
## the thing
BetweenTimes(t, open, close time.Time) returns a boolean value indicating whether the `t` value is inside of the hours and minutes of the `open` window and the `close`.
If the open time comes after the close time, then the window spans midnight (example: window is open from 10PM until 2AM). However, if the open time come before the close time (2AM to 10PM), then it behaves intuitively.
A return value of `true` means the submitted time is inside the window.