Lenovo ThinkPad E14 Gen 2 keeps shutting down

I have a Lenovo ThinkPad E14 Gen 2 laptop and every day at midnight, if the laptop is plugged in, it shuts down. If the Computer isn’t plugged in it won’t shut down but the second I plug it in, it will shut down regardless of the time I plug it in. Has someone faced a similar problem? I would really appreciate any help on the matter.