DALLAS — Boeing Co. will take a $4.9 billion charge to cover possible compensation to airlines with 737 Max jets that remain grounded after two deadly accidents.

The Chicago-based aerospace giant said Thursday that the calculation was based on an assumption that regulatory approval allowing the plane to resume commercial flights will begin early in the fourth quarter.

That timing is earlier than some analysts expect, which may have contributed to a rally in Boeing shares in after-hours trading.

Boeing said the after-tax charge will trigger a $5.6 billion reduction in revenue and pre-tax earnings for the April-through-June quarter. The company, one of Charleston region's biggest employers, is scheduled to report its latest financial results Wednesday.

Airlines around the world have canceled thousands of flights since March, when regulators grounded the  737 Max and the company suspended deliveries of new jets.

Boeing is also raising its estimate of Max production costs by $1.7 billion because production will be reduced longer than expected. It is still working on fixing flight-control software that appeared to play a role in crashes that killed 346 people off the coast of Indonesia and in Ethiopia.

The plane's return has been pushed back several times, most recently after Federal Aviation Administration pilots found a new flaw while testing Boeing software changes in a flight simulator.

That discovery prompted Boeing to say in late June that it expected to present its proposed fix to the FAA "in the September timeframe." It would likely take several more weeks for the FAA and other regulators to approve Boeing's work, give pilots additional training, and bring long-parked jets up to flying condition.

Boeing faces dozens of lawsuits in U.S. courts from families of the passengers. Families of the victims of the Oct. 29 crash of a Max operated by Indonesia's Lion Air have agreed to consider mediation, but relatives of passengers on an Ethiopian Airlines Max that crashed March 10 have resisted Boeing's requests, according to their lawyers.

Analysts have estimated that Boeing's liability to the families will be far less than the cost of compensating its airline customers.

We're starting a weekly newsletter about the business stories that are shaping Charleston and South Carolina. Get ahead with us - it's free.

Boeing says concessions to airlines will be spread over several years but it is taking the entire estimated expense as a charge in the second quarter. Boeing did not specify what form the compensation would take, but hinted that it would not be entirely in cash.

Despite the grounding, Boeing has kept building Max jets, although at a reduced rate of 42 per month, down from 52, since April. The company said Thursday that it assumed it can raise production gradually to 57 per month in 2020.

Boeing has delivered fewer than 400 Max planes but has unfilled orders for about 4,500. The jet is built in Renton, Wash.

Shares of Boeing rose $8.14, or 2.3%, to $369.25 in late trading. Before the announcement, they fell $8.41 to end regular trading at $361.11.