function parseRfc850Date (date, now = new Date()) {
  if (!date.endsWith('gmt')) {
    // Unsupported timezone
    return undefined
  }

  const commaIndex = date.indexOf(',')
  if (commaIndex === -1) {
    return undefined
  }

  if ((date.length - commaIndex - 1) !== 23) {
    return undefined
  }

  const dayName = date.substring(0, commaIndex)
  if (!RFC850_DAYS.includes(dayName)) {
    return undefined
  }

  if (
    date[commaIndex + 1] !== ' ' ||
    date[commaIndex + 4] !== '-' ||
    date[commaIndex + 8] !== '-' ||
    date[commaIndex + 11] !== ' ' ||
    date[commaIndex + 14] !== ':' ||
    date[commaIndex + 17] !== ':' ||
    date[commaIndex + 20] !== ' '
  ) {
    return undefined
  }

  const dayString = date.substring(commaIndex + 2, commaIndex + 4)
  const day = Number.parseInt(dayString)
  if (isNaN(day) || (day < 10 && dayString[0] !== '0')) {
    // Not a number, or it's less than 10 and didn't start with a 0
    return undefined
  }

  const month = date.substring(commaIndex + 5, commaIndex + 8)
  const monthIdx = IMF_MONTHS.indexOf(month)
  if (monthIdx === -1) {
    return undefined
  }

  // As of this point year is just the decade (i.e. 94)
  let year = Number.parseInt(date.substring(commaIndex + 9, commaIndex + 11))
  if (isNaN(year)) {
    return undefined
  }

  const currentYear = now.getUTCFullYear()
  const currentDecade = currentYear % 100
  const currentCentury = Math.floor(currentYear / 100)

  if (year > currentDecade && year - currentDecade >= 50) {
    // Over 50 years in future, go to previous century
    year += (currentCentury - 1) * 100
  } else {
    year += currentCentury * 100
  }

  const hourString = date.substring(commaIndex + 12, commaIndex + 14)
  const hour = Number.parseInt(hourString)
  if (isNaN(hour) || (hour < 10 && hourString[0] !== '0')) {
    return undefined
  }

  const minuteString = date.substring(commaIndex + 15, commaIndex + 17)
  const minute = Number.parseInt(minuteString)
  if (isNaN(minute) || (minute < 10 && minuteString[0] !== '0')) {
    return undefined
  }

  const secondString = date.substring(commaIndex + 18, commaIndex + 20)
  const second = Number.parseInt(secondString)
  if (isNaN(second) || (second < 10 && secondString[0] !== '0')) {
    return undefined
  }

  return new Date(Date.UTC(year, monthIdx, day, hour, minute, second))
}
@see https://httpwg.org/specs/rfc9110.html#obsolete.date.formats

@param {string} date
@param {Date} [now]
@returns {Date | undefined}