Nationwide spending on ride-hailing services Uber Technologies Inc. and Lyft Inc. plunged in the U.S. in the past two weeks as large numbers of Americans started working from home, avoided travel, and curtailed social gatherings in an effort to contain the spread of the novel coronavirus.

U.S. consumers spent 21% less on Uber rides in the seven days through March 16 compared with the seven days prior, according to data from market research-firm Edison Trends. It based its analysis partly on credit and debit card transactions. Spending on Lyft rides declined 19% over the same period, the data showed.

In the eight weeks through March 2, average week-over-week spending for Uber and Lyft rides rose 3% and 4%, respectively. Uber and Lyft declined to comment. The first death in the U.S. linked to the coronavirus occurred on Feb. 29.

The spending data underscores the challenges ahead for the companies as some of their most lucrative cities impose lockdowns. The precipitous decline came even before local authorities in the San Francisco area issued sweeping shelter-in-place mandates, ordering residents to avoid nonessential outings until at least April 7. New York City Mayor Bill de Blasio on Tuesday said residents there also should brace for such a possibility.