Not right. Legal stay is governed by your residence permit, not your work permit. A work permit that has not expired does not keep you legal if your residence permit has lapsed or no longer matches your situation.
Nationwide (all cities)
Not the work permit's date
The expiry date on your work permit is not the thing that keeps you legally present in China. That job belongs to your residence permit.
Two documents, two purposes
The two documents serve different purposes and are governed separately. The work permit authorises you to work for a specific employer. The residence permit governs your stay. Under the Regulations on Employment of Foreigners in China, your residence permit's validity is determined together with your employment certificate, but they are issued and handled as distinct documents.
Why the date is not a guarantee
This means a work permit that has not expired does not by itself keep you legal. If your employment ended and the residence permit was not renewed or no longer matches your situation, the fact that the work permit still shows a future date does not fix that. What you must watch is the residence permit's validity and whether it still matches your current situation.
What to watch
So do not read the work permit's expiry date as a guarantee of legality. Watch the residence permit — its expiry date and whether it still matches your employment — because that is what governs your legal stay.