One can't claim this without addressing Obama's (correct) decision to follow the spirit of the law and not push through[1] Merrick Garland when Republicans refused to conduct committee hearings[2].
As you said, McConnell and the Republican Senate refused to hold hearings on Obama's Supreme Court nominee, in March more than seven months before the election 2016 election - "Give the people a voice in the filling of this vacancy" said McConnell. [1]
The other half:
Four years later, they had no problem confirming Trump's nominee in late October, not two weeks before Trump's 2020 election - and McConnell said "The precedent only applies when different parties control the Senate and the White House." [2]
To me the inconsistency seems contrary to the spirit of democracy.
[1] https://newrepublic.com/article/138787/obama-can-put-merrick...
[2] https://en.wikipedia.org/wiki/Merrick_Garland_Supreme_Court_...