README.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. ================================================================================
  29. Usage
  30. ================================================================================
  31. To include a popup calendar in a form, use the type 'date_popup':
  32. $form['date'] = array(
  33. '#type' => 'date_popup':
  34. '#title => t('My Date'),
  35. ....
  36. );
  37. Set the #type to date_popup and fill the element #default_value with
  38. a date adjusted to the proper local timezone, or leave it blank.
  39. The element will create two textfields, one for the date and one for the
  40. time. The date textfield will include a jQuery popup calendar date picker,
  41. and the time textfield uses a jQuery timepicker.
  42. NOTE - Converting a date stored in the database from UTC to the local zone
  43. and converting it back to UTC before storing it is not handled by this
  44. element and must be done in pre-form and post-form processing!!
  45. ================================================================================
  46. Customization
  47. ================================================================================
  48. To change the default display and functionality of the calendar, set startup
  49. parameters by adding selectors to your element. The configurable options
  50. are:
  51. #date_type
  52. The type of date to convert the input value to, DATE_DATETIME, DATE_ISO, or
  53. DATE_UNIX
  54. #date_format
  55. a standard PHP date format string that represents the way the month, day,
  56. and year will be displayed in the textfield, like m/d/Y. Months and days
  57. must be in the 'm' and 'd' formats that include the zero prefix, the year
  58. must be in the 'Y' (four digit) format.
  59. Any standard separator can be used, '/', '-', '.', or a space.
  60. The m, d, and Y elements can be in any order and the order will be preserved.
  61. The time selector will add AM/PM if 'a' is in the format string.
  62. The default format uses the short site default format.
  63. #date_year_range
  64. the number of years to go backwards and forwards from current year
  65. in year selector, in the format -{years back}:+{years forward},
  66. like -3:+3
  67. #date_increment
  68. increment minutes and seconds by this amount, default is 1
  69. ================================================================================
  70. Example:
  71. ================================================================================
  72. $form['date'] = array(
  73. '#type' => 'date_popup',
  74. '#default_value' => '2007-01-01 10:30:00',
  75. '#date_type' => DATE_DATETIME,
  76. '#date_timezone' => date_default_timezone(),
  77. '#date_format' => 'm-d-Y H:i',
  78. '#date_increment' => 1,
  79. '#date_year_range' => '-3:+3',
  80. );