This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Cpt.Meatball
Cpt.Meatball

As title implies;

Is it possible to use the (awesome) date(time) picker from the back-end, at the front-end?

alxy
alxy

Short answer: no.

Cpt.Meatball
Cpt.Meatball

Bummer. Will search for something else instead. And the not-so-short answer?

Last updated

alxy
alxy

You can try to figure out what JS and CSS is used to create a datepicker like the one in October's backend. But it will definetly be easier to just use an existing one for the project. If your theme uses bootstrap, you could consider using this one: https://bootstrap-datepicker.readthedocs.org/en/latest/ (But there are tons of other options)

Cpt.Meatball
Cpt.Meatball

What a coincidence! Was just implementing that one. Thanks for the help by the way!

daftspunky
daftspunky

The datepicker used in the backend is called Pikaday

Cpt.Meatball
Cpt.Meatball

Awesooomeeeee. Thanks a bunch!

Edit: What's the Time picker called by the way? That's the one that's supersweet :O

Last updated

Tschallacka
Tschallacka

Just for reference, if you wish to use a datepicker widget in the backend in a partial for example you can use this.

    use Backend\FormWidgets\DatePicker;
    use Backend\Classes\FormField;
    // $this = Backend\Classes\Controller which is needed in widgetbase
    $datepicker = new DatePicker($this, new FormField('fromDate', 'whateverreally'));
    // $fromDate is a Carbon object
    $datepicker->data['fromDate'] = $fromDate;
    $datepicker->mode = 'date';
    echo $datepicker->render();

Should be relatively easy to modify for frontend.

1-8 of 8

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.