Yii2 Bootstrap 4
use kartik \ field \ fieldrange;
Use Kartik \ Form \ ActiveForm;
Use Kartik \ DateControl \ DateControl;
& lt; div class = "text-center" & gt;
& lt; span class = "H4 Secondary-Color" & gt; Create New Budget & LT; / span & gt;
& lt; / div & gt;
& lt;? php $ Form = ActiveForm :: Begin (['Options' = & gt; ['class' = & gt; 'user MT-5']]); ? & gt;
& lt;? = $ form- & gt; field ($ model, 'name') - & gt; textinput (['style' = & gt; 'Height: 50px; Border-Radius: 10rem;', 'Class' = & gt;' Form-Control ',' Placeholder '= & gt;' Budget Name ']) - & gt; label (false); ? & gt;
& lt;? = $ form- & gt; field ($ model, 'amount') - & gt; input ('Number', ['style' = & gt; 'Height: 50px; Border-Radius: 10rem;', 'Class' = & gt; 'Form-Control MB-4', 'Step' = & gt; '0.01', 'Placeholder' = & gt; 'amount']) - & gt; label (false); ? & gt;
& lt;? = $ form- & gt; field ($ model, 'wallet') - & gt; dropdownlist ($ WITEMS, ['PROMPT' = & GT; 'SELECT WALLET', 'STYLE' = & GT; 'Height: 50px; Border -Radius: 10rem; ',' Class' = & gt; 'Custom-SELECT']) - & gt; label (false); ? & gt;
& lt;? = FIELDRANGE :: WIDGET ([
'Form' = & gt; $ Form
'Model' = & gt; $ MODEL,
'label' = & gt; 'ENTER DATE RANGE',
'attribute1' = & gt; 'Date_START',
'attribute2' = & gt; 'Date_End',
'Type' = & gt; Fieldrange :: Input_Widget,
'widgetclass' = & gt; DateControl :: Class,
'widgetoptions1' = & gt; [
'SaveFormat' = & gt; 'php: u'
],
'widgetoptions2' = & gt; [
'SaveFormat' = & gt; 'php: u'
],
]);? & gt;
& lt; hr & gt;
& lt; div class = "Text-Right" & gt;
& lt;? = HTML :: SubmitButton ('', ['class' = & gt; 'BTN FA FA-Check Fa-LG MT-2'])? & GT;
& lt; / div & gt;
& lt;? PHP ActiveForm :: End (); ? & gt;
The choice of dates does not work, it turns out like this
Also choose the date it does not work, for some reason the table with the choice simply does not appear (only the edges can be seen in 2 screenshot)
Answer 1
You can use another DataPicker. Download in Composer.
“Moonlandsoft / Bootui-DateTimepicker”: “*”
in the form looks like this:
Use Bootui \ DateTimepicker \ DatePicker;
& lt;? = $ form- & gt; field ($ model, 'Birthdate') - & gt; widget (DatePicker :: classname (), [
'Options' = & gt; ['Class' = & gt; 'FORM-CONTROL'],
'daysofweekdisabled' = & gt; [0-6],
'pluginoptions' = & gt; [
'DateFormat' = & gt; Date ('Y-M-D'),
'DefaultDate' = & gt; $ model- & gt; Birthdate,
'autoclose' = & gt; True
'Format' = & gt; 'yyyy-mm-dd',
'firstday' = & gt; 1,
],
]);? & gt;
I can search for more solutions, because this topic is still relevant for me.