Not covered in the page, but dates can be a negative number of days from the epoch, which is what the fixups (+7) and using mod 7 twice are for, as negative mod 7 will yield a negative.
It is in fact covered in the page, as the heading for that formula specifically calls out “languages with signed "%", eg. C/C++”.
That is why there is a formula without that adjustment with a “posmod” aka any modulo where a positive divisor yields a positive value (Euclidean division as in rust’s `rem_euclid`, but also floored division as in Python or Ruby, langages with both mod and rem functions / operators generally have a floored division on mod and a truncated division on rem but that’s not a guarantee so check).
It is in fact covered in the page, as the heading for that formula specifically calls out “languages with signed "%", eg. C/C++”.
That is why there is a formula without that adjustment with a “posmod” aka any modulo where a positive divisor yields a positive value (Euclidean division as in rust’s `rem_euclid`, but also floored division as in Python or Ruby, langages with both mod and rem functions / operators generally have a floored division on mod and a truncated division on rem but that’s not a guarantee so check).