Work out which date actually applies — the printed use-by or best-before, or the shorter clock that starts the day a product is opened.
Generic date arithmetic only. Product-specific storage instructions on the label or from the manufacturer always take precedence, and food that smells, looks or tastes off should be discarded whatever the dates say.
The three date types mean different things. A use-by date is about safety: the product should not be used after it, even if it was opened earlier, and opening a product can shorten its life further but never extends it past the use-by date. A best-before date is about quality: the product is at its best before that date and typically remains usable afterwards, with gradual loss of flavour or texture. An opened-on limit is a separate clock — 'use within 5 days of opening' — that starts on the opening day and can easily expire before either printed date. When more than one applies, the earliest date governs, which is what the 'both' mode calculates.
Which date wins if a product has both a use-by date and a 'use within 3 days of opening' note? Whichever comes first. Opening starts the shorter clock, but nothing extends a product past its printed use-by date, so the effective date is the earlier of the two.
Is food safe after its best-before date? Best-before is a quality marker, not a safety deadline, and many shelf-stable products remain usable well past it. Use-by is the safety date and should not be exceeded. Either way, storage conditions matter, and any spoilage signs override the dates.