0
私は2つの日付ピッカー(Materializecss) チェックインの日付とチェックアウト日付のもう一つです。私が欲しいのは、チェックアウト日を1日前にチェックインしたいということです。 私はpickadate jsでこのコードを手に入れましたが、問題は最初のdatepickerで選択された日付がendpickerで有効になっていることです。何が起こるたいのは、私が2017年9月22日を選択すると、エンド日付ピッカーの最小の日付は、私は申し訳ありませんすることができませんでした(今日の変数を追加しました2017年9月23日pickadate:終了日は開始日の1日前にする必要があります
$('#dp_ci').pickadate(
{
selectMonths: true, // Creates a dropdown to control month
today: 'Today',
clear: 'Clear',
close: 'Ok',
min: new Date()
});
var from_$input = $('#dp_ci').pickadate(),
from_picker = from_$input.pickadate('picker')
var to_$input = $('#dp_co').pickadate(),
to_picker = to_$input.pickadate('picker')
// Check if there’s a “from” or “to” date to start with.
if (from_picker.get('value'))
{
to_picker.set('min', from_picker.get('select'))
}
if (to_picker.get('value'))
{
from_picker.set('max', to_picker.get('select'))
}
// When something is selected, update the “from” and “to” limits.
from_picker.on('set', function(event)
{
if (event.select)
{
to_picker.set('min', from_picker.get('select'))
}
else if ('clear' in event)
{
to_picker.set('min', false)
}
})
to_picker.on('set', function(event)
{
if (event.select)
{
from_picker.set('max', to_picker.get('select'))
}
else if ('clear' in event)
{
from_picker.set('max', false)
}
})