Hi, I believe I have found a bug in the date library. The full code is provided on the StackOverflow link below. But I think the bug exists somewhere in here:
DateTime1 = date(Y1, M1, D1, H1, Mn1, S1, _, _, _),
S2 is S1 + X,
date_time_stamp(date(Y1, M1, D1, H1, Mn1, S2, _, _, _), Stamp2),
When attempting to increment the seconds value S1 by a value X large enough that the Mn1 value needs to be incremented by 1, the Mn1 value will instead be incremented by 2. E.g. a Mn1 value of 22, S value of 59 and X value of 1, the Mn1 value should increment to 23 but it instead increments to 24. When attempting the same logic with Minutes and Hours instead, it works.