Functional Weave
Code in Rust

time.minutes-between@1.0.0

README.md

1,334 bytes · view raw

# time.minutes-between

The minutes from a start date and time to an end date and time. A night shift
from 22:00 on 22 September to 06:00 on 23 September is 480 minutes. Taking
the dates as well as the times is the point: with times alone, 22:00 to 06:00
is either -960 minutes or a guess that the end is "probably tomorrow", and a
shift longer than 24 hours cannot be expressed at all.

The answer is signed like dates.days-between: an end before the start is
negative, so swapped arguments are visible rather than silently becoming a
next-day shift.

**Local wall-clock time, no time zones.** Both times are read off the same
clock on the wall, and the answer is the difference between those readings.
It does not know about daylight saving: in the UK, 00:30 to 03:30 on 29 March
2026 is 180 minutes here though only 120 minutes passed, because the clocks
went forward at 01:00; on 25 October 2026 the same readings are 180 here and
240 in reality. Payroll and time-and-attendance rules differ on which of those
to pay, so this capability does not pick one silently: if real elapsed time
matters, convert both instants to UTC with a time zone database first and
subtract those.

Times are strictly HH:MM, 24-hour, 00:00 to 23:59. "24:00", "9:00" and
"5pm" are errors rather than guesses; the end of a day is 00:00 on the next
date.