Sometimes, I will think it is one day of the week (e.g Friday) when in reality, it's earlier in the week (e.g Tuesday).
Your challenge is to display the number of days my estimates are off by.
Given a day of the week I think it is, and the day of the week it actually is, output/return the number of days between the two.
Incorrect date, Actual Date -> Days between Monday, Monday -> 0 Friday, Tuesday -> 3 Saturday, Sunday -> 6 Tuesday, Friday -> 4 Thursday, Wednesday -> 1 Monday, Friday -> 3
- Dates have to be taken as the actual date name (
Sunday). This is non-negotiable.
- Date names must be taken as strings or equivalent in your language (ADTs aren't allowed unless they store their values as the allowed strings)
- Input and output can be given/taken in any reasonable format.
- Full program or function - it doesn't matter.
And finally, this is code-golf, so the answer in each language with the fewest bytes wins.
data WeekDay = Sunday | Monday | Tuesday ...and use that as input instead? \$\endgroup\$