k3vin023
k3vin023

Reputation: 15

Javascript Calendar.setup get selected date

I'am editing an existing system and they are using Calendar.setup instead of jquery datepicker. I already suggested that the datepicker is more upgraded than calendar.setup but then, they still want to use calendar.setup.

My Problem is, I dont know how to get the value of selected date.

 Calendar.setup
    (
        {
            inputField  : 'txtDate',       // ID of the input field
            ifFormat    : "%Y-%m-%d",       // The Date Format
            button      : 'txtDate'      // ID of the button
        }
    );

Upvotes: 0

Views: 8494

Answers (2)

user6647712
user6647712

Reputation: 1

var cal=Calendar.setup
    (
        {
            inputField  : 'txtDate',       // ID of the input field
            ifFormat    : "%Y-%m-%d",       // The Date Format
            button      : 'txtDate',      // ID of the button

        })
var seldate=cal.date

Upvotes: 0

Tyll
Tyll

Reputation: 33

Try this:

 Calendar.setup
    (
        {
            inputField  : 'txtDate',       // ID of the input field
            ifFormat    : "%Y-%m-%d",       // The Date Format
            button      : 'txtDate',      // ID of the button
            onSelect    : function(){
                              var calDate = this.selection.get();
                              var calHours = new String(this.getHours());
                              var calMinutes = new String(this.getMinutes());
                              var calTime = ((calHours.length == 1) ? '0'+calHours : calHours) + ((calMinutes.length == 1) ? '0'+calMinutes : calMinutes );
            }
        }
    );

Upvotes: 1

Related Questions