Excess Roth IRA contribution made in 2017 and withdrawn before filing in 2018. When and how do I pay taxes on any earnings?

Oct-17 - Contribute more than our income  into Roth IRA
Jan-18 - Withdraw excess and reinvest as 2018 contribution.
Jan-18 - Financial reports principal and earnings withdrawn.

I've seen TurboTax say to report taxes in 2019 for tax year 2018 after receiving 1099-R.
Also, I've seen TurboTax say to enter a mock 1099-R for tax year 2017.

When and how do I pay taxes on the earnings?