Climate-wise, Shanghai is not as far south as Hong Kong, which can be hot even in October and November. It's also not as far north as Beijing, where it can snow in the winter. With this in mind, we'd probably view late-October through mid-December and February through April as the best times to visit.