State tax credit for temprarily working in different state

From Jan - Jul of 2020, I lived in CA and had a job located on same state. In August I started a new job in NY while still staying at CA, until I moved to NY next month. So

  • Jan - Jul, lived and worked in CA (Job #1), have state tax withheld in CA from my Job #1 W2
  • Aug, lived in CA but worked in NY (Job #2), have state tax withheld in both CA and NY from my Job #2 W2
  • Sep - Dec, lived and worked in NY (Job #2), have state tax withheld in NY from my Job #2 W2

How do I file the state taxes?

Should I pay NY taxes for Aug - Dec, and CA taxes for Jan - Aug, and request for a CA tax credit in Aug?

Or pay NY taxes for Sep - Dec, and CA taxes for Jan - Aug?

And how much of the Job #2 W2 income goes to each state?

 

I'm using the TurboTax website.