Created
March 30, 2018 08:45
-
-
Save thomo/0068bf8e881fa88a778fdf8dae9c8e6c to your computer and use it in GitHub Desktop.
Small function to verify validity of datetime (to use with https://gist.github.com/thomo/8ac2bceb6400eb8868c651e8897be958)
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
function isDateTimeValid(second, minute, hour, day, month, year) | |
function check(x, xmin, xmax) | |
return x >= xmin and x <= xmax | |
end | |
return check(second, 0, 59) and check(minute, 0, 59) and check(hour, 0, 23) and | |
check(day, 1, 31) and check(month, 1, 12) and check(year, 0, 99) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment