A sealed bag of potting mix will usually last about a year before it goes stale. An open bag will last about two months. What often happens is that moisture enters the bag and causes the soil to grow mould and mildew.
If you decide to use older potting mix, I suggest laying it flat on a plastic bag and covering it with black builder's plastic. Leave this soil in the sun for several weeks. This will sterilise the soil and then you can use it again.
Just keep in mind that if the soil has a fungal infestation its best to bin it. Don't add this to your compost or it will infect it as well. - EricL
Most quality potting mixes contain controlled release fertiliser, and it starts releasing from the moment it is added to the mix on the production line. The older the mix, the more nutrients have been released and are accumulating within the bag. If the bag is stored for an extended period (more than 6-8 weeks) after purchase still sealed or open, the build up of nutrients can be sufficient to burn the tender young roots of plants, especially seedlings.
Most manufacturers therefore do not recommend storing bags for more than a few weeks. It is better for your plants to buy what you need, when you need it.
When it comes to used potting mix that's perhaps been in a pot for a couple of years already, it can be partially revived by adding either homemade or commercially prepared compost to it together with fresh controlled release fertiliser. The other option is to mix it 50/50 with fresh potting mix, again topping up the fertiliser component. - Noelle