do the time left logic in js