in my laravel project, i use persian datepicker and have a problem with add function.
new persianDate().add(String, Number);
My problem is that in this function, the return date is calculated from today's date, while I want to define the initial date myself. For example, I have a start date and a deadline, and I want to calculate the completion date. I am waiting for guidance.
<script>
$('#deadline').change(function() {
var dval =parseInt($('#deadline').val());
var startdate=document.getElementById("startdate").value;
var inputF = document.getElementById("enddate");
edate=new persianDate().format();
edate=new persianDate().add('days', dval).format('YYYY/MM/DD');
inputF.value = edate;
});
</script>
Note: This will NOT work here due to the missing library however this should work.
thisis the deadline element inside the function we can just use thethis.valuefor that.startdateelement value however I wrapped it in thenew Date()constinstead ofvarto be more modern in your code.