Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

datepicker min max date

    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
    });
Comment

PREVIOUS NEXT
Code Example
Javascript :: change text shadow javascript 
Javascript :: looping through local storage javascript 
Javascript :: angular ng owl date time custom format 
Javascript :: pdf to json online 
Javascript :: Convertir Map a Json 
Javascript :: stop mousemove event javascript 
Javascript :: how to convert an array into single quote strings 
Javascript :: learn nestjs 
Javascript :: getattribute javascript 
Javascript :: discord js send message to specific channel 
Javascript :: palindrome javascript 
Javascript :: document on click not working 
Javascript :: let var 
Javascript :: how to replace all occurrences of a string in javascript 
Javascript :: send variable to javascript promise 
Javascript :: model mongoose 
Javascript :: javascript get distance between months 
Javascript :: javascript remoe last character from string 
Javascript :: upi id regex 
Javascript :: get selected text input javascript 
Javascript :: regx to accept name 
Javascript :: html js how to draw on screen 
Javascript :: how to pass a prop in route 
Javascript :: useformik 
Javascript :: convert array object to string javascript 
Javascript :: date now javascript 
Javascript :: get index vanilla js 
Javascript :: How to reset ReactJS file input 
Javascript :: javascript array.from 
Javascript :: how to make a check if 50% of letters are capital in discord js 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =