My phone keeps turning itself off

Hi!

3 months ago I bought ZTE Grand X Intel. It was working perfectly fine until now. It started turning itself off in like 10 minutes after turning on. But this interval kept shortening by time and now it turns itself off even when booting up.

- If I run it directly from charger, It's working completely fine.

- I tried to run virus scan and reseted it to factory settings. -> didn't solve my problem

- I didn't root it or anything like that. Stock Android 4.0.4 is installed in there.

Any idea what's wrong with my phone? Is battery dead, or is it some serious failure in hardware?

Thank you.

Well if it works fine when connected to a charger, I think it's reasonable to assume the battery is at fault.