You are here

README.txt in Date 7.2

Drupal date_popup.module README.txt
==============================================================================

Javascript popup calendar and timeentry using the
jquery UI calendar and a choice of jquery-timeentry libraries.

================================================================================
Datepicker
================================================================================

This code uses the jQuery UI datepicker that is included in core. Localization
of the interface is handled by core.

The popup will use the site default for the first day of the week.

================================================================================
Timepicker
================================================================================

There are three ways to let users select time in the Date Popup widgets.
You can choose between them by going to admin/config/date/date_popup.

The options are:

1) Manual time entry - a plain textfield where users can type in the time.
2) A 'default' jQuery timepicker, included in the code
   (http://keith-wood.name/timeEntry.html).
3) The wvega timepicker (https://github.com/wvega/timepicker).

To install the alternate dropdown (wvega) timepicker:

Create a 'sites/all/libraries/wvega-timepicker' directory in your site
installation.  Then visit https://github.com/wvega/timepicker/archives/master,
download the latest copy and unzip it. You will see files with names like
jquery.timepicker-1.1.2.js and jquery.timepicker-1.1.2.css. Rename them to
jquery.timepicker.js and jquery.timepicker.css and copy them into
'sites/all/libraries/wvega-timepicker'.

The date_popup_timepicker module is also supported:
* https://www.drupal.org/project/date_popup_timepicker


================================================================================
Usage
================================================================================

To include a popup calendar in a form, use the type 'date_popup':

  $form['date'] = array(
    '#type' => 'date_popup':
    '#title => t('My Date'),
    ....
  );

Set the #type to date_popup and fill the element #default_value with
a date adjusted to the proper local timezone, or leave it blank.

The element will create two textfields, one for the date and one for the
time. The date textfield will include a jQuery popup calendar date picker,
and the time textfield uses a jQuery timepicker.

NOTE - Converting a date stored in the database from UTC to the local zone
and converting it back to UTC before storing it is not handled by this
element and must be done in pre-form and post-form processing!!

================================================================================
Customization
================================================================================

To change the default display and functionality of the calendar, set startup
parameters by adding selectors to your element. The configurable options
are:

#date_type
  The type of date to convert the input value to, DATE_DATETIME, DATE_ISO, or
  DATE_UNIX

#date_format
  a standard PHP date format string that represents the way the month, day,
  and year will be displayed in the textfield, like m/d/Y. Months and days
  must be in the 'm' and 'd' formats that include the zero prefix, the year
  must be in the 'Y' (four digit) format.

  Any standard separator can be used, '/', '-', '.', or a space.

  The m, d, and Y elements can be in any order and the order will be preserved.

  The time selector will add AM/PM if 'a' is in the format string.

  The default format uses the short site default format.

#date_year_range
  the number of years to go backwards and forwards from current year
  in year selector, in the format -{years back}:+{years forward},
  like -3:+3

#date_increment
   increment minutes and seconds by this amount, default is 1

================================================================================
Example:
================================================================================

$form['date'] = array(
  '#type' => 'date_popup',
  '#default_value' => '2007-01-01 10:30:00',
  '#date_type' => DATE_DATETIME,
  '#date_timezone' => date_default_timezone(),
  '#date_format' => 'm-d-Y H:i',
  '#date_increment' => 1,
  '#date_year_range' => '-3:+3',
);

File

date_popup/README.txt
View source
  1. Drupal date_popup.module README.txt
  2. ==============================================================================
  3. Javascript popup calendar and timeentry using the
  4. jquery UI calendar and a choice of jquery-timeentry libraries.
  5. ================================================================================
  6. Datepicker
  7. ================================================================================
  8. This code uses the jQuery UI datepicker that is included in core. Localization
  9. of the interface is handled by core.
  10. The popup will use the site default for the first day of the week.
  11. ================================================================================
  12. Timepicker
  13. ================================================================================
  14. There are three ways to let users select time in the Date Popup widgets.
  15. You can choose between them by going to admin/config/date/date_popup.
  16. The options are:
  17. 1) Manual time entry - a plain textfield where users can type in the time.
  18. 2) A 'default' jQuery timepicker, included in the code
  19. (http://keith-wood.name/timeEntry.html).
  20. 3) The wvega timepicker (https://github.com/wvega/timepicker).
  21. To install the alternate dropdown (wvega) timepicker:
  22. Create a 'sites/all/libraries/wvega-timepicker' directory in your site
  23. installation. Then visit https://github.com/wvega/timepicker/archives/master,
  24. download the latest copy and unzip it. You will see files with names like
  25. jquery.timepicker-1.1.2.js and jquery.timepicker-1.1.2.css. Rename them to
  26. jquery.timepicker.js and jquery.timepicker.css and copy them into
  27. 'sites/all/libraries/wvega-timepicker'.
  28. The date_popup_timepicker module is also supported:
  29. * https://www.drupal.org/project/date_popup_timepicker
  30. ================================================================================
  31. Usage
  32. ================================================================================
  33. To include a popup calendar in a form, use the type 'date_popup':
  34. $form['date'] = array(
  35. '#type' => 'date_popup':
  36. '#title => t('My Date'),
  37. ....
  38. );
  39. Set the #type to date_popup and fill the element #default_value with
  40. a date adjusted to the proper local timezone, or leave it blank.
  41. The element will create two textfields, one for the date and one for the
  42. time. The date textfield will include a jQuery popup calendar date picker,
  43. and the time textfield uses a jQuery timepicker.
  44. NOTE - Converting a date stored in the database from UTC to the local zone
  45. and converting it back to UTC before storing it is not handled by this
  46. element and must be done in pre-form and post-form processing!!
  47. ================================================================================
  48. Customization
  49. ================================================================================
  50. To change the default display and functionality of the calendar, set startup
  51. parameters by adding selectors to your element. The configurable options
  52. are:
  53. #date_type
  54. The type of date to convert the input value to, DATE_DATETIME, DATE_ISO, or
  55. DATE_UNIX
  56. #date_format
  57. a standard PHP date format string that represents the way the month, day,
  58. and year will be displayed in the textfield, like m/d/Y. Months and days
  59. must be in the 'm' and 'd' formats that include the zero prefix, the year
  60. must be in the 'Y' (four digit) format.
  61. Any standard separator can be used, '/', '-', '.', or a space.
  62. The m, d, and Y elements can be in any order and the order will be preserved.
  63. The time selector will add AM/PM if 'a' is in the format string.
  64. The default format uses the short site default format.
  65. #date_year_range
  66. the number of years to go backwards and forwards from current year
  67. in year selector, in the format -{years back}:+{years forward},
  68. like -3:+3
  69. #date_increment
  70. increment minutes and seconds by this amount, default is 1
  71. ================================================================================
  72. Example:
  73. ================================================================================
  74. $form['date'] = array(
  75. '#type' => 'date_popup',
  76. '#default_value' => '2007-01-01 10:30:00',
  77. '#date_type' => DATE_DATETIME,
  78. '#date_timezone' => date_default_timezone(),
  79. '#date_format' => 'm-d-Y H:i',
  80. '#date_increment' => 1,
  81. '#date_year_range' => '-3:+3',
  82. );