Sort pantry inventory

Sort manually dated pantry items from earliest to latest and flag dates within the next seven days.

freeworks offlinenothing uploaded
ToolPantry Inventory Sorter
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Each row supplies an item, quantity, and real ISO calendar date; subtracting UTC midnights produces whole days from the selected comparison date. Negative values are labelled expired, zero through seven use soon, and later dates ok before the list is sorted ascending.

  • The seven-day window is an organizational setting, not a food-safety threshold.
  • An explicit comparison date keeps a saved list reproducible instead of depending on the viewer’s current clock.

Worked example

Sort pantry inventory
Input
											Items: Rice, 2 bags, 2027-02-01
Yogurt, 4, 2026-08-27
Today: 2026-08-24
										
Output
												Item    Quantity  Expiry      Days remaining  Status
------  --------  ----------  --------------  --------
Yogurt  4         2026-08-27  3               use soon
Rice    2 bags    2027-02-01  161             ok
											

When to use this

Households rotate shelf stock, refrigerator lists surface near-dated food, and meal plans sort opened products by a manually recorded date.

Edge cases

  • 2026-02-31 is rejected as a nonexistent date instead of silently rolling into March.
  • A date exactly seven days ahead is use soon, whereas eight days ahead is ok.
  • The label cannot decide whether food is safe because storage conditions and the meaning of the package date are not provided.

References