It's random... I've had one Sim die 9 days after she turned elder, whereas her husband died 19 days later!