0

Hullo, I am working with a datepicker that allows users to enter a date schedule for given tasks.

However, I want the dates that have passed to be disabled from the datepicker, so that the user only selects a future date.
Here is what I am using currently;

<script type="text/javascript">
                        $(function() {
                            //var altFormat = $( "#datepicker" ).datepicker( "option", "altFormat" );
                            $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd',changeYear:true,changeMonth:true,yearRange:'1900:2002'});
                            //getter
                            var dateFormat = $( "#datepicker" ).datepicker( "option", "dateFormat" );
                            //setter
                            $( "#datepicker" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );
                        });
3
Contributors
7
Replies
21
Views
4 Years
Discussion Span
Last Post by Webville312
0

hai Webville312,

i think u need to set the minDate property for achieving this like as follows (incase if you are using Jquery Datepicker)

$("#datepicker").datepicker({ minDate: 0 });

let me know the status

happy coding

0

I have tried that out, but there is no difference ... the dates are all still enabled ...

0

I dunno but is it me who is writing it wrong?? Here is the code I am using right now;

   <script type="text/javascript">
                        $(function() {
                            //var altFormat = $( "#datepicker" ).datepicker( "option", "altFormat" ).datepicker({ minDate: 0 });
                            $( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd',changeYear:true,changeMonth:true,yearRange:'1900:2002'});
                            //getter
                            var dateFormat = $( "#datepicker" ).datepicker( "option", "dateFormat" );
                            //setter
                            $( "#datepicker" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );
                        });

Any more ideas ...?

0

This is my aproach on a needed way, check this out.

            $('.' + obj + ' .deliv_date').datepicker({
                dateFormat: "yy-mm-dd", 
                showButtonPanel: true,
                beforeShow: function(input, inst) {
                    var calendar = inst.dpDiv;
                    setTimeout(function() {
                        calendar.position({
                            my: 'right top',
                            at: 'right bottom',
                            collision: 'none',
                            of: input
                        });
                    }, 1);
                },
                changeYear: true,
                changeMonth: true,
                minDate: 0,
                beforeShowDay: $.datepicker.noWeekends,
                numberOfMonths: 1
            });
0

hai Webville312

you havn't set the minDate Property in your code
try to change your code as follows its work fine for myside

$( "#datepicker" ).datepicker({ dateFormat: 'yy-mm-dd',changeYear:true,minDate:0,changeMonth:true,yearRange:'1900:2002'});

check it once and let me know the status
happy coding

[edited]

Edited by radhakrishna.p: giving clarity on my solution

0

Thanx radhakrishna [Hope I got that right].
It worked like a charm ....

Thanx once again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.