MyBB Community Forums

Full Version: Datetime input in the DefaultForm class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
There is a method in the DefaultForm class, generate_date_select, which is used to generate a date selection. However, there is no function to generate date + time inputs. In a plugin I'm working on, I created such a function that uses the "date" and "time" inputs.

require_once MYBB_ROOT . "cgdadmin/inc/class_form.php";

/**
 * Workaround for a method that doesn't exist in the DefaultForm class
 */
class ModifiedForm extends DefaultForm {
    function generate_datetime_field($name, $date="", $time="") {
        return "<input type=\"date\" name=\"" . $name . "_date\" id=\"" . $name . "_date\" value=\"" . $date . "\" />
                <input type=\"time\" id=\"" . $name . "_time\" name=\"" . $name . "_time\" value=\"" . $time . "\"";
    }
}


Could something similar be implemented into MyBB?
Could be nice as a plugin helper.

Would be nice to implement for the task system and any other place where suitable.