cl date function working differently in Intel and M1 machines
The answer (thanks to a hint by @mmmmmm in the comments) is that in the M1 Mac mini you have to install the gnu coreutils (e.g. via Homebrew), but since the names of some of them overlap with the names of similar (but not identical!) utilities that come with the Mac mini, the system automatically prefixes &quot;g&quot; to any utilities whose names overlap.
Therefore, the problem was solved in my case by changing date to gdate in my code.