Data-date-picker-range-with-em-financeiro baseado em um documento
function getCurrentFinancialYear(strDocDate) {
var startYear = "";
var endYear = "";
var docDate = new Date(strDocDate);
if ((docDate.getMonth() + 1) <= 3) {
startYear = docDate.getFullYear() - 1;
endYear = docDate.getFullYear();
} else {
startYear = docDate.getFullYear();
endYear = docDate.getFullYear() + 1;
}
console.log({startDate : startYear+"-03-01", endDate: endYear+"-03-31" });
return {startDate : startYear+"-03-01", endDate: endYear+"-03-31" };
}
$(document).ready(function () {
$('.datepicker').datepicker({
format: 'yyyy-mm-dd',
maxViewMode: 0,
todayBtn: "linked",
clearBtn: true,
autoclose: true,
todayHighlight: true,
startDate: getCurrentFinancialYear($('input.datepicker').val()).startDate,
endDate: getCurrentFinancialYear($('input.datepicker').val()).endDate
});
});
Jaskaran