Onions are similar to potatoes in this case. They are perishable, and will not last indefinitely. But if they are stored properly in a cool, dark place (your pantry), they can last up to 1 month (as long as they remain whole/uncut).