How to bypass ssl expired validation with axios?

ive tried using process.env.NODE_TLS_REJECT_UNAUTHORIZED = ‘0’
and setting

 httpsAgent = new https.Agent({
    requestCert: true,
    rejectUnauthorized: false
  });
  axios.defaults.httpsAgent = httpsAgent;
const res = await axios.post(url, data, { httpsAgent });

but still fail with:

connect: x509: certificate has expired or is not yet valid: current time 2021-12-17T06:51:04Z is after 2021-10-24T16:07:28Z