You wrote, your are using a loop, but you apply the feature based on ID ('#timeOff2'). But there can be only one element on the page with such ID. I am not wondering that it does not work, you mishandle the html standard. Don't reuse ID within page. In this case you should use class. And you don't need
each either.
$('.DatePicker-needed').datepicker({ dateFormat: "dd/mm/yy", yearRange: 'c:c+10', changeMonth: true, changeYear: true});