Residency status and state taxes: New job, WFH for two months and then moving

Hi! 

 

I live in NY and just started to a new job in PA on July 1. I will move to PA in late August. How does that affect my residency status and how to know what taxes I will owe in each state? Thank you!