jqueryを使用して2つのカレンダーから2つの日付を取得しようとして
いますが、どうすればよいですか。
コード :
<div id="checklinkform" data-role="fieldcontain">
<label for="checkin">Date début :</label></td>
<input name="checkin" id="checkin" data-role="datebox" type="date" data-mini="true"
data-options='{"closeCallback":"linkedCheckin", "noButton": false, "closeCallbackArgs":["checkin"], "mode": "calbox", "focusMode": true, "centerWindow": true, "afterToday": false, "beforeToday":true}'>
<input name="checkin_monthday" type="hidden" size="2" id="checkin_monthday" data-mini="true"/>
<input name="checkin_year_month" type="hidden" size="7" id="checkin_year_month" data-mini="true"/>
<label for="checkout">Date fin :</label></td>
<input name="checkout" id="checkout" data-role="datebox" type="date" data-mini="true"
data-options='{"calHighToday":false, "closeCallback":"linkedCheckin", "noButton": false, "closeCallbackArgs":["checkout"], "mode": "calbox", "focusMode": true, "centerWindow": true}'>
<input name="checkout_monthday" type="hidden" size="2" id="checkout_monthday" data-mini="true"/>
<input name="checkout_year_month" type="hidden" size="7" id="checkout_year_month" data-mini="true"/>
</div>
編集。
これが私が使用しているcheklinkform関数です:
linkedCheckin = function (date, name) {
// The widget itself
var self = this,
// The day after whatever just got set
nextday = date.copymod([0,0,1]);
// Today
today = new Date();
// The difference of today and whatever got set (secs)
diff = parseInt((date - today) / ( 1000 * 60 * 60 * 24 ),10);
// The same difference, in days (+2)
diffstrt = (diff * -1)-2;
// Lets fill in the other fields.
$('#'+name+'_year_month').val(self._formatter('%Y-%m', date));
$('#'+name+'_monthday').val(self._formatter('%d', date));
// Update the seen output
$('#checkoutput').text($('#checklinkform input').serialize());
// If we edited the checkin date, more work to do
if ( name === "checkin" ) {
// Ok, so in steps: (nuke the comments)
// Set the (internal) checkout date to be whatever was picking in checkin +1 day
$('#checkout').data('datebox').theDate = nextday;
// Show that to the user
$('#checkout').trigger('datebox', {'method':'doset'});
// Make sure that minDays won't let them check out same day or earlier
$('#checkout').datebox({"minDays": diffstrt});
// Open it up
$('#checkout').datebox('open');
}
}
別の関数で送信するために2つの日付を取得したい