Given a MM/DD
date (12/24
) and a start/end date range (11/01 - 06/24
), figure out if the date is within the listed date span.
Date ranges can be sequential (05/01 - 11/01
) or wrap around to the next year (11/01 - 05/01
).
Examples:
12/24
is in11/01 - 06/24
= True06/24
is in11/01 - 06/24
= True06/24
is in06/24 - 06/24
= True06/24
is in11/01 - 06/23
= False07/24
is in11/01 - 06/24
= False07/24
is in05/01 - 11/01
= True07/24
is in07/23 - 07/20
= True
Years do not mater. The date and/or date range is assumed to apply for any year past or future.
The end date will always be after the start date. If the end date is numerically less than the start date, we assume we are wrapping around to the next year.
The three input variables can be via any method (args, HTTP, stdin, etc..) and in any format (string, JSON, array, etc..)
Response can be boolean
or any form of a yes/no/correct/etc.. string. Shortest code wins.
You cannot simply pass args to a built-in function.
['MM', 'DD']
? \$\endgroup\$11/01 - 06/24 includes 06/24?
\$\endgroup\$['06', '24']
if right else[]
or what do you mean? \$\endgroup\$2017
and next year2018
. How are we supposed to determine that06/24
means2018
and thus should beTrue
rather than2017
and thusFalse
because it's before11/01
? \$\endgroup\$date > start & date < end
" - Then some of your test cases are wrong. I think what you mean isstart<=date<=end
. \$\endgroup\$