Coscho
Coscho

Reputation: 89

jquery datetimepicker minDate on radio button change

I have this script http://jsfiddle.net/Kj55E/6/

I am using datetimepicker plugin

I have following issue: exp_date minDate has to be begin_date + 1 . Everything works OK on first run. But after I change begin_date ... minDate for exp_date don't refresh... Please help

Thank you Coscho

Upvotes: 0

Views: 673

Answers (1)

KingKongFrog
KingKongFrog

Reputation: 14419

Instead of initiating with click, try putting all your logic in the onClose event of #begin_date

The end_date is being initiated on click...not on selection.

        $('#begin_date').datetimepicker({
            showSecond : true,
            dateFormat : 'yy-mm-dd',
            timeFormat : 'hh:mm:ss',
            stepMinute : 5,
            stepSecond : 5,
            minDate: 1,
            onClose: function () {
                test = $("#begin_date").datetimepicker('getDate');
                testm = new Date(test.getTime());
                testm.setDate(testm.getDate() + 1);

                $("#exp_date").datetimepicker("option", "minDate", testm);
                $("#exp_date").datetimepicker('setDate', testm );
            }

Upvotes: 1

Related Questions