I don't think this is a battery issue. I've had my HTC One M8 for two years with no problem & this issue started happening with my phone yesterday. It's not like the battery degraded overtime - one day it worked fine, the next it shuts-down as soon as its unplugged.
I have done a factory...