[[PageOutline(2-5,Contents,pullout)]]

= Add custom date fields to tickets and helps date selection

{{{#!box warn
This plugin is deprecated in Trac 1.2 and later. Custom fields of type [trac:wiki:1.1/TracTicketsCustomFields#AvailableFieldTypesandOptions time] were added in Trac 1.1.1.
}}}

== Description

This plugin provides a datepicker for ticket and milestone fields, and validation of the date string for ticket custom fields. It will only validate that the given input has the specified date format (see below). The value is stored in the database as a string, as Trac does not yet have date field support (t:#1942). Note: It is not the intention of this plugin to provide date-type support.

{{{#!NewsFlash

= Development News =

 * Version 3.0.0: The 1.0 branch is a development branch that has been created to support work forwards version 3.0 of the plugin, which will only support Trac 1.0 and later.
 * Version 2.0.0: The 0.12 branch is a development branch that has been created to support work towards version 2.0 of the plugin, which will only support Trac 0.12 and later.
 * Version 1.1.0: The jQuery UI component has been downgraded to 1.6 to ensure compatibility with jQuery 1.2.6 that ships with Trac 0.11.x.

}}}

With release 1.0, Trac has integrated the jQuery UI library along with datepicker and datetimepicker extensions into the core. 

Pick a date on tickets and milestones:

'''0.11 branch''' ------------------- '''Development branch'''

[[Image(DatePickerTrac011.png, 13%)]] [[Image(DateFieldPlugin.png, 15%)]]

== Bugs/Feature Requests

Existing bugs and feature requests for !DateFieldPlugin are [report:9?COMPONENT=DateFieldPlugin here].

If you have any issues, create a [/newticket?component=DateFieldPlugin new ticket].

[[TicketQuery(component=DateFieldPlugin&group=type,format=progress)]]

=== Known issues

If you have the AutoQueryPlugin installed, you'll need to patch the !DateFieldPlugin to work with it, see comment:4:ticket:6796.

== Source

You can check out !DateFieldPlugin from [/svn/datefieldplugin here] using Subversion, or [source:datefieldplugin browse the source] with Trac.

== Download

Download the zipped source from [export:datefieldplugin here].

== Installation

 1. '''Install''' globally with:
{{{#!sh
sudo easy_install https://trac-hacks.org/svn/datefieldplugin/1.0/
}}}
 1. '''Enable''' the plugin by updating TracIni file (..../trac.ini) as follows:
{{{#!ini
[components]
datefield.* = enabled
}}}
 1. '''Configure''' the project management support for the plugin in its own configuration section, placed into 'trac.ini' file as follows: 
   1. To add a Due Date, just set up the field as a [http://trac.edgewall.org/wiki/TracTicketsCustomFields custom field], or use the CustomFieldAdminPlugin (image right) to create a date field: [[Image(customfields.jpg, right, 20%)]]
 {{{#!ini
[ticket-custom]
due_date = text
due_date.date = true
due_date.label = Due Date
# special value <now> works with 1.0 branch only
due_date.value = <now>
due_date.date_empty = true
}}}
   The example demonstrated use of the special value `<now>`, which is supported only on the 1.0 branch. The value will be replaced with the current date.
   1. Site-wide defaults for macro arguments may be set at the [datefield] section:
{{{#!ini
[datefield]
format = mdy
separator = -
first_day = 1
}}}
   More details about them see [#Arguments #Arguments section].
 1. '''Restart''' web server on command line:
{{{#!sh
sudo /etc/init.d/apache2 restart
}}}

=== Arguments

This plugin can be controlled with a number of arguments, inside `[datefield]` section contained in `trac.ini` configuration file:

||'''Argument'''  ||'''Version'''  ||'''Description'''	||'''Default[[BR]]value''' ||
|| `format`|| ||The format to use for dates. valid formats are `dmy`, `mdy`, and `ymd` || `dmy` ||
|| `separator`|| ||The separator character to use for dates. Possible values are `-` or `.` or `/` || `/` ||
|| `first_day`|| >= [6118] ||First day of the week (0=Sunday .. 6=Saturday) || `0` ||
|| `months`|| >= [7192] ||How many months to show at once? || `1` ||
|| `milestone`|| >= [7192] ||Use datepicker for milestone due/complete fields? (format= must match your locale) If you turn this on, you must use `MM/DD/YYYY` for the date format. Set format to `mdy` and separator to `/`. || `false` ||
|| `weeknumbers`|| >= [7192] ||Show ISO8601 week number in calendar? || `false` ||
|| `panel`|| >= [7192] ||Show panel with a "Today" and "Done" buttons (at bottom)? || `false` ||
|| `change_month`|| >= [7192] ||Show a dropdown with month selection?  || `false` ||
|| `change_year`|| >= [7192] ||Show a dropdown with year selection?  || `false` ||
|| `match_request`|| >= [7192] ||Use datepicker on arbitrary request paths. Use text fields with class=datepick in your template, and configure the start of request path (in list format), like: ''match_request = /query,/other_path'' || `` ||
|| `months`|| >= [7192] ||Number of months visible in datepicker  || `1` ||

There are many other options, but you need to modify the `datefield.html` template if you want to use them. See [http://docs.jquery.com/UI/Datepicker].

== Recent Changes

[[ChangeLog(datefieldplugin, 3)]]

== Author/Contributors

'''Author:''' [wiki:coderanger] [[BR]]
'''Maintainer:''' [[Maintainer]] [[BR]]
'''Contributors:''' [wiki:doki_pen], [wiki:terje] [[BR]]
