In Southern California, a heat wave this weekend foreshadowed the likely challenges that lay ahead for governors and mayors trying to sustain social distancing efforts as spring turns to summer.

Despite pleas from state and local leaders to stay home, tens of thousands of people flocked to beaches that were open in Orange County on Saturday. Photographs of Newport Beach and Huntington Beach showed large crowds staking out patches of sand with beach towels and umbrellas. The Orange County Register reported that as many as 40,000 people went to the beach in Newport Beach on Friday.

In neighboring Los Angeles County, all beaches remained closed this weekend.

“We won’t let one weekend undo a month of progress,” Mayor Eric Garcetti of Los Angeles wrote on Twitter on Sunday. “While the sunshine is tempting, we’re staying home to save lives. The places we love — our beaches, hiking trails — will still be there when this is over. And by staying home, we’re making sure our loved ones will be too.”

Dr. Deborah Birx, the White House coronavirus response coordinator, said Americans should expect social distancing guidelines to continue for months. “Social distancing will be with us through the summer,” she said Sunday on NBC’s “Meet the Press.”