apparently most people don't really understand expiration dates which makes sense because they're pretty opaque if you aren't interpreting it as 'on this date throw in trash' but esp with the extension of covid test expiration I thought I could peel back the curtain
The basics of how an expiration date is determined is that when a product is first developed (or a new kind of packaging is used!) in the early stages of production, a number of the product is set aside and put into special temperature/climate storage. Sometimes at multiple temperatures. Then every x increment of time, one or a few of the product is pulled out of special storage and inspected for suitability. This can involve culturing for bacteria, smell and taste, using the product, chemical testing for concentrations of active ingredients, and just looking at it and saying 'would a consumer still want to use this'
This is repeated for several units of time until one of several end conditions happen: 1) the product expires or is determined to be unsuitable, 2) they run out of special sample products, or 3) they want to start selling the thing so they say 'well it lasts at least this long so we'll go with that'
Then they take the amount of time from production until the last ideal test (say, 6 months if that's how long the company wanted to go from initial production for testing to starting to distribute) and they add that number to the production date to get the expiration date.
That means an expiration date can mean one of two things. 1) after this date, the product is very likely to be expired or 2) we know the product lasts at least this long, but probably longer.
And companies will sometimes continue expiration date testing after the initial production run (ex. 6 months after the first production) and will update the expiration time on subsequent test runs (so a later production will have an expiry of 8 months after production, then 10, then 12... until they run out of test samples or find an actual expiry)
that means the products from that test run will actually last as long as the later test runs, but have a shorter stamped date just because the company didn't know it would last longer.
In products with short shelf lives (a few days or weeks) the shelf life is very accurate. So your pasteurized milk will probably go bad right around that stamped date as long as it was stored properly. But in products with very long shelf lives, the shelf life may be much longer than the stamped date (hence why you'll hear people saying it's fine to eat expired canned goods as long as the can is still in perfect condition). And with products like limited/special edition products or that were rushed to production (covid tests) the expiry may be updated as continued expiration date testing happens.
Just to be clear: Don't assume any expired product is safe to use
Especially for products that have been around for a long time or have short, easy to test expiration dates, testing has been done to
Sell-by and use-by dates, on the other hand, are often based on 1) 'this product won't look as appetizing after this date, so get it sold by or use it by then' and applies to products that may oxidize or change color or get soft or bruise (think fresh foods and condiments) or 2) 'this product is intended to be home-processed and how long it lasts depends on how it's processed so we don't guarantee anything past this point' like meats and eggs
Also, some products (dry/powder makeup, spices, supplements) are often very safe to use after the use-by date but lose some efficacy/don't look as good (if a spice is expired by a year or two you may need to double it, if a blush hasn't been used consistently and is expired, try scraping off the top layer. don't take extra of a supplement tho because you won't know how much the efficacy it's lost and could end up with toxicity).
Keep the refrigerator temperature at or below 40° F (4° C). FDA
The freezer temperature should be 0° F (-18° C). FDA
Never leave food out of refrigeration over 2 hours. If the temperature is above 90 °F, food should not be left out more than 1 hour. USDA
Store all drugs and supplements in the temperature range listed on the packaging