For purposes of this act, if a shareholder of an S corporation is both a resident and a nonresident of this State during any taxable year, the shareholder's pro rata share of the S corporation income allocated to this State and S corporation income not allocated to this State for the taxable period shall be further prorated between the shareholder's periods of residence and nonresidence during the taxable period, in accordance with the number of days in each period.
N.J.S. § 54A:5-13