getByDate script fix