Check your template applications.
Shot
Recently while trying to issue some certificates from XCA, I struggled with getting XCA to issue certifivates with a defind expiry datetime. No matter what I did to set the dates manually, the validity period expires at was always “undefined” aka “forever”.

Chaser
Turns out the the reaosn is because I was applying an XCA template that specifically checked [x] No Defindd Expiry Time.

The application of such a template overrides the expiry time of certificates, evem you specifically uncheck the option, and even if you specifically set an expiry time.
The UI won’t reflect this. The Certificate creation dialogs will tell you that you set an expiry time properly, but then you go and check the values of the created certificate and notice that the expiry date remains undefined.
So, double check your templates.