Counting by local clocks, PVG -> SFO sets you back about 5 hours.
You have to land at SFO at a time when the immigration facilities will be open. We've been delayed boarding & ground held a bit at PVG because of this. Winds aloft meant we were going to have a fast crossing and the pilot didn't want to get us to SFO and then have to sit there not allowing us off because there was noplace for us to go.
How could you avoid having a night in the sky that way?