2016-10-26 20 views
0
echo $form->field($model, 'dob')->widget(DatePicker::classname(), [ 
    'options' => [ 
    'placeholder' => Yii::t('app', 'Please pick your birth-date'), 
    ], 
    'type' => DatePicker::TYPE_INPUT, 
    'pluginOptions' => [ 
    'autoclose'=>true, 
    'format' => 'dd/mm/yyyy', 
    'startView' => 1, 
    ], 
])->label(Yii::t('app', 'Date of Birth')); 

上記のコードは、yiiiでDatePickerを作成するために使用されています。yii 2今日の日付ピッカーのみ今日まで許可

+0

使用している日付ピッカー –

答えて

1

はい、将来の日付はendDateプロパティの無効化をpluginOptionsとすることができます。

echo $form->field($model, 'dob')->widget(DatePicker::classname(), [ 
    'options' => [ 
    'placeholder' => Yii::t('app', 'Please pick your birth-date'), 
    ], 
    'type' => DatePicker::TYPE_INPUT, 
    'pluginOptions' => [ 
    'autoclose'=>true, 
    'format' => 'dd/mm/yyyy', 
    'startView' => 1, 
    'endDate'=>date('d/m/Y') 
    ], 
])->label(Yii::t('app', 'Date of Birth')); 
+0

はい!まさに私が必要なもの。ありがとうございました :) – CloudSeph

関連する問題