<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}themes/green/css/LE_MetaId99.css">
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery/jquery.ui.datepicker.js"></script>
<script>
$(document).ready(function(){
    if ($("#id_start_date").length) {
        $("#id_start_date").datepicker({
            dateFormat: "dd/mm/yy",
            minDate: new Date(),
            onSelect: function(){
                enddate = $(this).val();
                splittedval = enddate.split('/');
                var date = new Date(splittedval[2], splittedval[1]-1, splittedval[0]);
                //date.setDate(date.getDate() + 1); // Uncomment this line to add 1 to the date
                $("#id_end_date").datepicker( "option", "minDate", date );
            }
        });
    }
    if ($("#id_end_date").length) {
        $("#id_end_date").datepicker({
            dateFormat: "dd/mm/yy",
            minDate: new Date()
        });
    }
    /* FOR Form Validation Purpose uncomment the following */
    /*
    $.validator.addMethod(
        "hasDatepicker",
        function(value, element) {
            // use following for the format DD/MM/YYYY
            var re = /^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/;
            // use following for the format MM/DD/YYYY
            // var re = /^(0[1-9]|1\d|2\d|3[01])\/(0[1-9]|1[0-2])\/(19|20)\d{2}$/;
            // use following for the format YYYY/MM/DD
            // var re = /^(19|20)\d{2}\/(0[1-9]|1\d|2\d|3[01])\/(0[1-9]|1[0-2])$/;
            return re.test(value);
        }
    );
    */
});
</script>

comments powered by Disqus