yii2-datecontrol icon indicating copy to clipboard operation
yii2-datecontrol copied to clipboard

Enhance DateControl to support Date Ranges

Open kartik-v opened this issue 10 years ago • 9 comments

Support two options using DatePicker::TYPE_RANGE and DateRangePicker


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

kartik-v avatar Feb 19 '15 03:02 kartik-v

Ah, good to see this is already being worked on. I just tried to use the following:

<?= $form->field($model, 'rented_timestamp')->widget(DateControl::className(), [
        'type'=> DateControl::FORMAT_DATE,
        'saveFormat' => 'php:Y-m-d H:i:s',
        'options' => [
            'type' => DatePicker::TYPE_RANGE,
            'attribute2' => 'due_timestamp',
            'pluginOptions' => [
                'todayHighlight' => TRUE,
                'autoclose' => TRUE,
                'todayBtn' => 'linked',
                'minView' => 2
            ]
        ]
    ]) ?>

And it only creates a hidden field for the first input element.

EAnushan avatar Feb 19 '15 06:02 EAnushan

I tried the code and only stores the first field, the second field attribute2 not save it.

Thks, @EAnushan

tecnologiaterabyte avatar Feb 20 '15 15:02 tecnologiaterabyte

@EAnushan & @tecnologiaterabyte ... as I mentioned in this comment --- DateControl will not work with RANGE - because it currently only understands one input to convert...

kartik-v avatar Feb 20 '15 15:02 kartik-v

:No problem kartikv you just commented. :+1:

tecnologiaterabyte avatar Feb 20 '15 15:02 tecnologiaterabyte

Any updates on this? :)

vadim-bulochnik avatar Nov 21 '17 11:11 vadim-bulochnik

Sorry not got time to look into this. Will do so when I get time. Feel free to submit a PR if you wish to speeden this.

kartik-v avatar Nov 21 '17 13:11 kartik-v

+1

developedsoftware avatar Dec 02 '19 18:12 developedsoftware

+1

eggnukes avatar Jan 24 '20 10:01 eggnukes

+1

Fluit avatar Oct 07 '20 12:10 Fluit