I will keep most things a max of a week, unless it’s something unopened, like cheese or yogurt. Of course, some items I will throw out before a week, depending on what it is and if it’s unlikely I will ever eat it.
I have gotten to where I no longer take home leftovers from restaurants because I put it in the refrigerator and then never eat it, and then end up throwing it out anyway. If I’m with someone I will offer it to them. Otherwise, unless it’s something like steak, I don’t bother. I’ve only been to two restaurants in the past 4 months but still, I plan to continue doing this when I start eating in restaurants more. A friend of mine will ask to take home teeny-tiny amounts of food, like two tablespoons of salad, and she has “issues” with old food in her refrigerator. I can see that having too many containers of leftovers is too much to keep track of and manage.