JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.22/themes/base/jquery-ui.css">
Start Date: <input type="text" id="startdatepicker"/><br />
End Date: <input type="text" id="enddatepicker"/><br />
JavaScript
$(document).ready(function() {
// Get current date
var now = new Date();
// Get the day, 0 is Sunday and 6 is Saturday
var day = now.getDay();
// How many days to this sunday
var daysToSunday;
if (day == 0) {
// Sunday is now
daysToSunday = 0;
} else {
daysToSunday = 7 - day;
}
// Days to next saturday is simple:
var daysToNextSaturday = daysToSunday + 6;
// See defaultDate option,
// http://jqueryui.com/demos/datepicker/#option-defaultDate
$("#startdatepicker").datepicker({
dateFormat: 'dd/mm',
defaultDate: daysToSunday
});
$("#enddatepicker").datepicker({
dateFormat: 'yy-mm-dd',
defaultDate: daysToNextSaturday
});
});