Late on Wednesday, President Donald Trump announced he would deliver the State of the Union address after the partial government shutdown—now on its 34th day—ends. The decision came after more than a week of squabbling between Trump and Speaker of the House Nancy Pelosi. The decision, if final, may end the strange, weeklong conflict.

How did we get to this point? And why did the president reverse himself on Wednesday? Here’s a timeline of events.

• Wednesday, Jan. 16: Pelosi sends a letter to Trump to “suggest” the president reschedule the address, originally set for Jan. 29, until after the shutdown, citing the planning and security work needed from federal employees who are not being paid during the shutdown. She also offered him the alternative of submitting the address in writing. A spokesman for Pelosi later clarified that the letter was not a rescinded invitation but instead a simple proposal.

• Later in the day, Homeland Security Secretary Kirstjen Nielsen tweeted that the department was prepared to provide security for the speech. Pelosi would later retort that Nielsen “should be advocating for her employees to be paid.”

• Thursday, Jan. 17: While not officially responding to Pelosi’s letter, Trump one-upped Pelosi’s suggestion with an order. He notified her that her previously undisclosed trip to meet with NATO leaders in Brussels and troops in Afghanistan (which he called a “seven-day excursion”) would be postponed because of the shutdown. “In light of the 800,000 great American workers not receiving pay, I am sure you would agree that postponing this public relations event is totally appropriate,” he said in the statement. Trump, as commander in chief, can deny a congressperson’s use of military transport, which Pelosi was to have used because of security concerns.

• After criticism over the announcement, the White House canceled Treasury Secretary Steven Mnuchin’s planned trip to Davos, Switzerland, for the World Economic Forum. Melania Trump still went ahead with a trip to Florida on a government jet for a weekend vacation.

• Friday, Jan. 18: Pelosi’s office alleged that the speaker would not attempt to fly commercially to Afghanistan because the White House had leaked information about the trip, putting the congressional delegation in danger. The Trump administration called the allegation a “flat-out lie.” No news outlets appeared to have reported on the plans before Pelosi released her statement decrying the leaks, but Pelosi’s spokesman told Slate that they had discovered multiple sources from the administration were attempting to leak the news that morning.

• Sunday, Jan. 20: Trump let Pelosi know he hadn’t forgotten the matter:

Nancy, I am still thinking about the State of the Union speech, there are so many options - including doing it as per your written offer (made during the Shutdown, security is no problem), and my written acceptance. While a contract is a contract, I’ll get back to you soon! — Donald J. Trump (@realDonaldTrump) January 20, 2019

• Tuesday, Jan. 22: ABC News reported that Trump was planning two State of the Union speeches: one official one for Congress, which he planned to deliver on the scheduled date in the House chamber or elsewhere in D.C., and one unofficial one at a political rally outside of D.C. White House Press Secretary Sarah Huckabee Sanders told reporters that the White House was moving forward with plans to hold the address in the House.

• Wednesday, Jan. 23: Trump finally responded to Pelosi’s earlier suggestion of postponing the State of the Union, dismissing the idea that there would be security risks. “Therefore I will be honoring your invitation, and fulfilling my Constitutional duty, to deliver important information to the people and Congress of the United States of America regarding the State of our Union,” he said in a letter to Democratic leaders. “It would be very sad for our Country if the State of the Union were not delivered on time, on schedule, and very importantly, on location!”

• Pelosi responded that afternoon, meeting his challenge to disinvite him from giving the address. “I am writing to inform you that the House of Representatives will not consider a concurrent resolution authorizing the President’s State of the Union address in the House Chamber until government has opened,” she wrote in a letter. “Again, I look forward to welcoming you to the House on a mutually agreeable date for this address when government has been opened.”

• Trump, who called her decision a “disgrace” and declared that “the State of the Union has been canceled by Nancy Pelosi because she doesn’t want to hear the truth,” said he would look for alternative locations for the speech. Officials in West Virginia, North Carolina, and Michigan invited him to deliver the speech in their states. Some senators encouraged the president to host the address in their chamber.

• Shortly after 11 p.m., Trump appeared to cave, announcing in a tweet that he would deliver the address after the shutdown ends. “As the Shutdown was going on, Nancy Pelosi asked me to give the State of the Union Address,” he tweeted. “I agreed. She then changed her mind because of the Shutdown, suggesting a later date. This is her prerogative - I will do the Address when the Shutdown is over. I am not looking for an … alternative venue for the SOTU Address because there is no venue that can compete with the history, tradition and importance of the House Chamber. I look forward to giving a ‘great’ State of the Union Address in the near future!”

According to the Washington Post, Pelosi is the first House speaker in history to deny the use of the chamber to the president for his State of the Union address (no president has delivered it elsewhere since the capital moved to Washington in 1800). While updating Congress on the state of the union is constitutionally mandated, there is no deadline for it to take place, and it places no limit on the shutdown.