New York State non resident tax: how is AGI pro-rated when on a long leave during the year?

I was on 5 months paid family leave when in CA, and moved to NJ in December. I am due to pay NY non-resident tax as I work in NY. 
Can anyone figure out why NY is taxing 25% of my AGI?

Number of days in period of employment = 366

non-working days= 249 (115 of which are PFL)

Outside of New York= 97

Worked Outside of New York at Home =10

 

Effectively, my NY working days (plus WFH) = 20

 

With this math, NY tax rate comes out to 20/97, when in fairness it should be 20/240 ish.. ? but why is it neither but even higher at 25%