This function lets you get the start and end date of Indian financial year based on given date.
This can also be modified for US financial year.
This can also be modified for US financial year.
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;
}
return {startDate : "01-Apr-" + startYear, endDate: "31-Mar-" + endYear };
}
alert(getCurrentFinancialYear("4/1/2018").startDate);