JScalendar
Produces a DHTML popup calendar (date-picker) using the jscalendar library. The library is created and maintained by: http://www.dynarch.com/projects/calendar while the Drupal module is maintained by Nedjoe.
Requirements: Drupal 5.x (This module will not be updated to Drupal 6.0)
Installation:
Create a directory modules/jscalendar (or, for easy updating, modules/jstools/jscalendar) and copy all the module's files into it, as well as the folder 'lib' and its contents. Enable the module via the administer > modules page.
Adding the popup date picker to a textfield:
To include a jscalendar popup with a textfield, just add the class 'jscalendar':
<?php
$form['date'] = array(
'#type' => 'textfield',
'#attributes' => array('class' => 'jscalendar'),
);
?>
Customization:
To change the default display and functionality of the calendar, set startup parameters by adding selectors to your element. The three configurable options are 'ifFormat' (the format of the date/time written to the text field), 'showsTime' (boolean: should time be displayed on the calendar), and 'timeFormat' (values of '12' for 12-hour clock, which is the default, or '24'
for 24-hour clock).
Example:
<?php
$form['date'] = array(
'#type' => 'textfield',
'#attributes' => array('class' => 'jscalendar'),
// Use only year, month, and day in textfield.
'#jscalendar_ifFormat' => '%Y-%m-%d',
// Don't show time.
'#jscalendar_showsTime' => 'false',
// Show 24-hour clock.
'#jscalendar_timeFormat' => '24',
);
?>
Localization
Jscalendar comes with numerous localization files, see the /lib/lang directory. By default, the module will look at the current Drupal $locale and load an appropriate localization file, defaulting to 'en' for unsupported languages. To explicitly set the localization file to be used, call jscalendar_load() with your desired localization as the argument. Example:
jscalendar_load('it');
Additional Reading Material
Look in your downloaded javascript library for jscalendar-1.0/doc/reference.pdf and also jscalendar-1.0/doc/html/reference.html.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion