The challenge is simplistic, given an input time as a string in any one of the following formats:
hh
, hh:mm
or hh:mm:ss
with 0 ≤ hh ≤ 23
, 0 ≤ mm ≤ 59
and 0 ≤ ss ≤ 59
.
Output what time it currently is using the following symbols:
AA LABEL FOR CHARACTER CODE POINT HEXADECIMAL
== ==================== ========== ===========
🕐 Clock Face 01 Oclock 128336 0x1F550
🕑 Clock Face 02 Oclock 128337 0x1F551
🕒 Clock Face 03 Oclock 128338 0x1F552
🕓 Clock Face 04 Oclock 128339 0x1F553
🕔 Clock Face 05 Oclock 128340 0x1F554
🕕 Clock Face 06 Oclock 128341 0x1F555
🕖 Clock Face 07 Oclock 128342 0x1F556
🕗 Clock Face 08 Oclock 128343 0x1F557
🕘 Clock Face 09 Oclock 128344 0x1F558
🕙 Clock Face 10 Oclock 128345 0x1F559
🕚 Clock Face 11 Oclock 128346 0x1F55A
🕛 Clock Face 12 Oclock 128347 0x1F55B
In the following format:
It is currently {Clock Face 1} with {mm} minutes and {ss} seconds until {Clock Face 2}.
Examples (Including all fringe cases):
Case with only hours...
f("12") = "It is currently 🕛."
Case with hours and minutes...
f("12:30") = "It is currently 🕛 with 30 minutes until 🕐."
Case with only hours, but has minutes included as 00...
f("12:00") = "It is currently 🕛."
Case with hours, minutes and seconds...
f("12:30:30") = "It is currently 🕛 with 29 minutes and 30 seconds until 🕐."
Case with hours and minutes, but has seconds included as 00...
f("12:30:00") = "It is currently 🕛 with 30 minutes until 🕐."
Case with hours and minutes, with less than a minute until the next hour...
f("12:59:59") = "It is currently 🕛 with 1 seconds until 🕐."
You do not have to change from plural to singular.
Case with hours and minutes, with 1 minute to the next hour...
f("12:59") = "It is currently 🕛 with 1 minutes until 🕐."
You do not have to change from plural to singular.
Case using military time (yes you must handle this)...
f("23:30:30") = "It is currently 🕚 with 29 minutes and 30 seconds until 🕛."
Invalid cases...
f("PPCG") = This cannot occur, you are guaranteed a valid format by the definition of the problem.
f(66:66:66) = This cannot occur, you are guaranteed valid numbers by the definition of the problem.
f(24:60:60) = This cannot occur, you are guaranteed valid numbers by the definition of the problem.
You do not have to conform to any style of output for invalid cases, errors are fine.
Overall the challenge is rather simplistic, but seemed to be dynamic enough to be fun in my opinion. The shortest code here is the winner as there isn't much variable aspect to the code other than length.
0 < hh < 24
,0 < mm < 60
and0 < ss < 60
, you meant0 ≤ hh ≤ 23
,0 ≤ mm ≤ 59
and0 ≤ ss ≤ 59
. \$\endgroup\$AM
orPM
tags? \$\endgroup\$