A partial government shutdown in Donald J. Trump’s first term was the longest in U.S. history.