Can I use the battery from an early 2014 MacBook Air in a mid 2012 Air? I just bought a used mid-2012 MacBook Air to replace the early-2014 model my dog killed but the battery life is terrible comparatively. 

Can I take the battery out of the 2014 and use it in the 2012 safely?
Yes. According to iFixit, all 2010 through 2017 MacBook Air's use the same battery:

https://www.ifixit.com/Store/Mac/MacBook-Air-13-Inch-Late-2010-to-2017-Replacement-Battery/IF188-113-2

That's assuming we are talking about the 13". If you are talking about an 11", that changes things.