Whether an egg is 'safe' to eat is ENTIRELY dependant on how much bacteria it contains when consumed. This is a function of how much bacteria it started with, how it has been stored and at what temperature it has been stored and for how long and also the health of the consummer. Temperature and time are important as bacteria rapidly multiplies at room temperature, so obviously if it starts with a significant amount of bacteria it can rapidly go off. People with a normal healthy immune system can cope with greater amounts of bacteria than younger children, older people, sick people or those with impaired immune systems. For this reason these risk groups should only be given fully cooked eggs.
Smelling eggs is not a reliable test though obviously rancid eggs should not be eaten and neither is floating an egg which will only tell you how long it has been laid. Eggs lose water through evapouration through the pores in their shell over time so eggs which float are simply old. Also older hens tend to lay more bouyant eggs as the egg's air pocket is usually larger than with a pullet. Floating tells you nothing directly about it's bacteria load other than older eggs are more suspect than fresh ones.
If you start with a 'normal' clean egg from a healthy hen and you store it in a hygienic way in a fridge it will ast (as Auntie says) for months though 4 weeks is the notional time usually quoted. fertile eggs stored at 15degC can remain viable (hatchable) for 14 days though 8 days is usually the practical limit quoted as % hatchability starts to fall of significantly after this.
So the answer is not a clear cut one. Clean well stored in a fridge eggs last at least 4 weeks and in practise significantly longer. At room temperature they will last at least two weeks and in practise longer.
Dirty eggs should not be washed and should be used for cooking only, as soon as possible. Within a couple of days if kept in a sanitary way to prevent cross contamination in a fridge. Cracked eggs should be discarded unless you crack them after collection and then you must use them immediately and not store them for more than a couple of hours in a fridge. This is because you will have no idea how long eggs cracked in the nestbox have been exposed to contamination whereas if you crack it yourself you do.
Storing in a fridge in dry conditions will always extend the life of an egg and ensure it remains freshest longest and is the safest "official" advice given by food agencies.
HF