Deductions & credits

If you meet the 330 day test over two different calendar years, does that qualify ALL of the income earned in the second calendar year to be excluded, or does it only include the income earned in the months included in the 12 month period? Example: July 1 2018 to June 30 2019 meets the 330 day test, but the period January to December 2019 does NOT meet the 330 day test -- do they get the entire year excluded, or only January to June 30 excluded, and the other foreign income earned from July 1 2019 to December 31 2019 is taxed in the U.S?