code: function parseRetryAfter(retryAfter) {
      // Only parse once
      if (typeof retryAfter === 'number') {
          return retryAfter;
      } else if (isNaN(retryAfter)) {
        return Math.ceil((new Date(retryAfter).getTime() / 1000) - Date.now() / 1000);
      } else {
        return parseInt(retryAfter, 10); 
      }
  }
docs: Parse retry-after header delay to get next request retry attempt date in seconds * "Fri, 31 Dec 2018 23:59:59 GMT" "Thu Jul 12 2018 12:53:16 GMT-0700 (Pacific Daylight Time)" "120"