Input values from js are not sent to the model but they are in input

I have code in JS that populates input fields in a form. The code fills in the data correctly but when I upload the model to the server the data is default instead of what I have entered in the fields. How to solve this?

My js code:

$('input[name="datefilter"]').on('apply.daterangepicker', function(ev, picker) {
      $(this).val(picker.startDate.format('DD/MM/YYYY') + ' - ' + picker.endDate.format('DD/MM/YYYY'));

      StartOfReservation.value = picker.startDate.format('YYYY-MM-DD');
      EndOfReservation.value = picker.endDate.format('YYYY-MM-DD');//.trigger("change"); - doesnt work

  });