Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.
/ cakephp-nicedate Public archive

Replaces CakePHP's default 3 dropdown dates with text inputs using jQueryUI date picker and time picker inputs

Notifications You must be signed in to change notification settings

dlancea/cakephp-nicedate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cakephp-nicedate

Replaces CakePHP's default date input (three dropdowns) with text inputs using jQueryUI date picker and time picker inputs

##Installation

Add the files to your plugin directory (app/Plugin) in a sub-directory called NiceDate/

Add the plugin to your Config/bootstrap.php file as

CakePlugin::load('NiceDate');

Add the NiceDateForm helper to your helpers as an alias classname for the built-in Cakephp FormHelper:

App::import('View/Helper', 'NiceDate.NiceDateFormHelper');

class AppController extends Controller {
  public $helpers = array(
		'Form' => array(
			'className' => 'NiceDateForm'
		),
  );
}

If you have your own FormHelper class, you can extend NiceDateFormHelper.

Optionally, you can also change the datetime validation for the new inputs by making your models (or one model) inherit the NiceDate behavior:

In AppModel or specific models:

App::uses( 'NiceDate.NiceDate', 'Behavior' );

class AppModel extends Model {
  public $actsAs = array( 'NiceDate.NiceDate' );
}

##What does it do?

NiceDate overwrites the built-in FormHelper input types datetime, date, and time. It also adds duration, which is two datetimes which are linked together.

##Known bugs

For some reason, you can't overwrite the default notEmpty validation function in a behavior. So instead dates need to use the "nicenotempty" validation due to the change in date inputs.

About

Replaces CakePHP's default 3 dropdown dates with text inputs using jQueryUI date picker and time picker inputs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published