sfJQueryDateTimeFormWidgetPlugin - 1.0.1

A plugin used to implement a jquery date and time picker widget within the forms

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source


A plugin using juqery TimePicker library to provide a dropdown of time based on specification of intervals and start and stop times. Feel free to contact me with any questions.


  • Install jQuery (http://www.jquery.com) somewhere under your web folder (preferably under web/js).

  • Install jQuery timePicker (http://github.com/perifer/timePicker) somewhere under your web folder (preferably under web/js).

  • Install jQuery-UI (http://www.jqueryui.com) somewhere under your web folder (preferably under web/js).

  • Install Datejs (http://www.datejs.com) somewhere under your web folder (preferably under web/js).

  • Add the jQuery, timePicker, jQuery-UI and Datejs JavaScript files to the javascripts list in your application's config/view.yml file.

    • Add any CSS files you want to use for timePicker and datePicker, and add them to the stylesheets list in view.yml.
  • Install the plugin. Using symfony command line: ./symfony plugin:install sfJQueryTimeDateFormWidgetPlugin Or get the latest version from the subversion repository: svn co http://svn.symfony-project.com/plugins/sfJQueryTimeDateFormWidgetPlugin plugins/sfJQueryTimeDateFormWidgetPlugin

  • If you installed by subversion, activate the plugin in the config/ProjectConfiguration.class.php file (this will have already been done automatically if you used the plugin:install symfony command).

    class ProjectConfiguration extends sfProjectConfiguration
      public function setup()

How to use

  • Edit a form, for example lib/form/doctrine/MyForm.class.php. To use the date component, do something like this:

    $fromOptions = array(
                         'default_time'=>'12:00 AM'
    $untilOptions = array(
                          'default_time'=>date('h:i A')
        'staff'      => new sfWidgetFormDoctrineChoice(array('model' => 'Staff', 'add_empty' => false)),
        'from'     => new sfJQueryDateTimeWidget($fromOptions),
        'until'    => new sfJQueryDateTimeWidget($untilOptions),
  • Edit an action, for example apps/frontend/modules/timequery/actions/actions.class.php and add and implement the following function to perform date time queries:

    private function convertParamToDatetime($time) {
        $time = DateTime::createFromFormat('Y-m-d h:i A',$time);
        if($time instanceof DateTime)
            return $time->format('Y-m-d H:i:s');
            return null;
  • Clear your cache. ./symfony cc

  • Test your form.


  • widget_name (string) the name of the widget
  • time_interval (string) a number from one to 60 to minumize minute selection
  • params (array) an array of form request data
  • default_date (string) the default date for the date picker in YYYY-mm-dd
  • default_time (string) the default time for the time picker in hh:ii AA
  • time_start_stop (array) an array with two keys: * start (string) the start time of the time picker in HH.MM * stop (string) the stop time of the time picker in HH.MM
  • time_image (string) a path to an image to display as the time picker button