Weeks to months...
Depending on what part of the nail is injured as well as its severity.
If the bruising is mild, it may heal quickly. If the injury is more severe such that it is causing damage to the nail bed or forming a "blood-clot" from bleeding into the area, it may take however long it is for your nail to grow to the tip/edge of your toe/finger. It is faster for a finger nail to grow comparing to toenail.