Package com.atlassian.jira.util
Interface DateFieldFormat
- All Known Implementing Classes:
DateFieldFormatImpl
@ThreadSafe
public interface DateFieldFormat
Helper for handling JIRA date fields. Dates in JIRA are displayed as day/month/year and are interpreted according to
the date picker format. Even though we use java.util.Date instances internally, only the year/month/day are relevant
in a date field. Dates are used in a few places throughout JIRA:
- the issue due date
- the date custom field
- the project version release date
- Since:
- v4.4
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionFormats a date using the JIRA date format.formatDateInTimeZone(Date date, TimeZone timeZone) Formats a date using the Jira date format and in the specified time zone.formatDateInUserTimeZone(Date date) Formats a date using the JIRA date format and in the timezone of the logged in user.formatDatePicker(Date date) Formats the given date for usage in a date picker.Returns a string containing the format that this class is capable of parsing.booleanisParseable(String text) Returns a boolean indicating whether the given text contains a valid date.parseDatePicker(String text) Returns a date that is obtained by parsing the given text.Returns a date that is obtained by parsing the given text.parseDatePickerInUTC(String text) Returns a date that is obtained by parsing the given text.
-
Method Details
-
format
Formats a date using the JIRA date format.- Parameters:
date- a Date- Returns:
- a String containing a formatted date
-
formatDateInUserTimeZone
Formats a date using the JIRA date format and in the timezone of the logged in user.- Parameters:
date- a Date- Returns:
- a String containing a formatted date
-
formatDateInTimeZone
Formats a date using the Jira date format and in the specified time zone.- Parameters:
date- a DatetimeZone- a TimeZone to use for formatting- Returns:
- a String containing a formatted date
-
formatDatePicker
Formats the given date for usage in a date picker.- Parameters:
date- a Date- Returns:
- a String containing a formatted date
-
parseDatePicker
Returns a date that is obtained by parsing the given text. The string representation of the date is assumed to be in the system time zone.- Parameters:
text- a String representation of a date- Returns:
- a Date
- Throws:
IllegalArgumentException- if the text cannot be parsed
-
parseDatePickerInUserTimeZone
Returns a date that is obtained by parsing the given text. The string representation of the date is assumed to be in the time zone of the logged in user.- Parameters:
text- a String representation of a date- Returns:
- a Date
- Throws:
IllegalArgumentException- if the text cannot be parsed
-
parseDatePickerInUTC
Returns a date that is obtained by parsing the given text. The string representation of the date is assumed to be in UTC.- Parameters:
text- a String representation of a date- Returns:
- a Date
- Throws:
IllegalArgumentException- if the text cannot be parsed
-
isParseable
Returns a boolean indicating whether the given text contains a valid date.- Parameters:
text- a String representation of a date- Returns:
- a boolean indicating whether the given text contains a valid date
-
getFormatHint
String getFormatHint()Returns a string containing the format that this class is capable of parsing.- Returns:
- a String containing the format hint
-