# inventory.expiry-fefo First expiry, first out: fill a request from the batches that expire soonest, so perishable, dated or shelf-life stock is used before it goes out of date. **What counts as in date.** A batch is usable when it has at least `minShelfLifeDays` days left on the pick date: `daysBetween(asAt, expiry) >= minShelfLifeDays`. With 0, stock expiring on the pick date itself is still usable (a use-by date is the last day of use); pass 1 to exclude it, or a customer's minimum remaining shelf life (say 10 days) to keep short-dated stock back. Batches that fail are never picked and are listed in `skipped`, earliest expiry first, so they can be quarantined or written off. **Order.** Usable batches are taken earliest expiry first; batches with the same expiry are taken in the order given (sort them by location or receipt date first if that matters). A batch is used up before the next is started, so the list has at most one part-used batch, the last. **Not enough stock is an answer, not an error.** The list picks everything usable and reports the rest as `shortfall`, which a warehouse needs to back-order or short-ship. Batches with no units are ignored, neither picked nor skipped. Negative quantities, a negative shelf life and malformed dates are errors. This works in whole units. It does not reserve stock, so two picks run from the same batch list will both take the same units. Source: FEFO as described in the EU Good Distribution Practice guidelines (2013/C 343/01), section 5.5, and the GS1 General Specifications for expiry dates (AI 17).