State tax filing

In your reply, you say that "Your income will be allocated between Illinois and Massachusetts based on the months that you were a resident of each state. " 

 

How does Turbo Tax determine the months you were a resident of each state?  I have a 1099-NEC that was earned entirely while working from IL for a MA firm.  

I have a W2 entirely earned while living in MA working for the same MA firm.

How do I tell TT which goes where?
I want to avoid paying full state taxes on the same income to both MA and IL for the 1099-NEC and I don't want to pay any IL state taxes for the W2.