How long can baby sleep in a bassinet?

Is it an age or weight thing or is it when they start to roll over?? Thank you!!