how much you wanna bet ChatGPT is trained on GNU utilities and the things it suggest do something entirely different on BSD‐based platforms like macOS
if you were wondering, apparently the answer is
if test ! -f build/.mtime; then printf '%b' '\n' > build/.mtime; fi; touch -r "$FILE" build/.mtime; TZ=UTC0 diff -u build/.mtime /dev/null | sed '1!d;s/.*\t\([^ ]\) \([^ ]\).*/\1T\2Z/'
(replacing \t with a tab character)
BUT this requires version 7 of POSIX
BUT it should still work in e·g Macintosh even tho they’re not strictly conformant
apparently the answer if you want to limit yourself to v6 in theory is to do the same thing but tarball the temporary file with pax and then read out the modified time in list mode with -o 'listopt=%(mtime=%Y-%m-%dT%H:%M:%SZ)T'
if you want to limit yourself to v6 in practice (nobody actually implements listopt), same thing but manually parse the tarball
“chatgpt how to get the last modified time of a file using only posix commandline utilities”