Yet, at the same time, you don't want your coffee to be too fresh, and it takes about a week for roasted beans to release contained gas. So with such a short window of time for consumption ...
Ground beans lose their freshness more quickly than whole beans so, ideally, buy coffee beans regularly and in small quantities, and grind them just before use. Make sure you grind whole beans ...