State tax filing

Why wouldn’t I just get a CA credit for the portion paid to NY?

The W2 isn’t going to show the bonus as CA income so how can CA allege that a bonus paid after moving is related to CA