Ahhh, topic of endless debate with so many variables! We put this complicated question to the experts that roast our best selling coffee beans.
Craig Margolius, Founder, SYP Coffee
As a general rule of thumb, many palettes may not see any degradation in taste in a ground bag of coffee, as long as its stayed sealed and has a degassing valve, for 30+ days. Once opened, it should be kept in a cool, dry dark place and can render a beautiful cup for at least 2 weeks. Whole bean, as a rule, has a longer shelf life with less surface area of the coffee exposed to oxygen and staling. I once had a roaster tell me I had 7 minutes to pull an espresso shot after grinding before flavors would begin to break down-ha!
Also, there are many nuances around this general timeline—in fact, flavors can actually develop beautifully anywhere from 3 days to 2 weeks off roast as coffee rests and degasses... and some roasters infuse their bags with nitrogen to extend a sealed bag's shelf life although once opened, science takes hold.