When a field path resolves to a date string (e.g. created, duedate, updated), you can chain date operations.
Formatting (returns a string, ends the chain)
|
Operation |
Description |
Example Output |
|
.jiraDate |
Jira date format |
"2024-01-15" |
|
.jqlDate |
JQL date format |
"2024-01-15" |
|
.jiraDateTime |
Full Jira datetime |
"2024-01-15T09:30:00.000+0000" |
|
.shortDate |
Short date |
"1/15/24" |
|
.shortTime |
Short time |
"9:30 AM" |
|
.shortDateTime |
Short date + time |
"1/15/24 9:30 AM" |
|
.mediumDate |
Medium date |
"Jan 15, 2024" |
|
.mediumTime |
Medium time |
"9:30:00 AM" |
|
.mediumDateTime |
Medium date + time |
"Jan 15, 2024 9:30:00 AM" |
|
.longDate |
Long date |
"January 15, 2024" |
|
.fullDate |
Full date with weekday |
"Monday, January 15, 2024" |
|
.fullDateTime |
Full date + time with weekday |
"Monday, January 15, 2024 9:30:00 AM UTC" |
|
.format("pattern") |
Custom date-fns pattern |
"15/01/2024" (using "dd/MM/yyyy") |
|
.prettyDuration |
Render a human-readable string using your Jira
|
"3h 20m" |
Arithmetic — chainable, returns a date
|
Operation |
Description |
|
.plusDays(n) |
Add n days |
|
.minusDays(n) |
Subtract n days |
|
.plusWeeks(n) |
Add n weeks |
|
.minusWeeks(n) |
Subtract n weeks |
|
.plusMonths(n) |
Add n months |
|
.minusMonths(n) |
Subtract n months |
|
.plusYears(n) |
Add n years |
|
.minusYears(n) |
Subtract n years |
|
.plusHours(n) |
Add n hours |
|
.minusHours(n) |
Subtract n hours |
|
.plusMinutes(n) |
Add n minutes |
|
.minusMinutes(n) |
Subtract n minutes |
Boundaries — chainable, returns a date
|
Operation |
Description |
|
.startOfMonth |
First moment of the current month |
|
.endOfMonth |
Last moment of the current month |
|
.startOfWeek |
First moment of the current week (Monday) |
|
.endOfWeek |
Last moment of the current week (Sunday) |
|
.toStartOfDay |
Midnight of the same day |
Setters — chainable, returns a date
|
Operation |
Description |
|
.withDayOfMonth(n) |
Set day of month to n |
|
.withMonth(n) |
Set month to n (1 = January) |
|
.withYear(n) |
Set year to n |
Attributes — returns a number or string
|
Operation |
Returns |
Description |
|
.dayOfMonth |
number |
Day of month (1–31) |
|
.dayOfWeek |
number |
ISO day of week (1=Mon, 7=Sun) |
|
.dayOfWeekName |
string |
Day name (e.g. "Monday") |
|
.month |
number |
Month (1–12) |
|
.year |
number |
4-digit year |
|
.hour |
number |
Hour (0–23) |
|
.minute |
number |
Minute (0–59) |
|
.second |
number |
Second (0–59) |
|
.weekOfYear |
number |
ISO week number |
Comparison — returns boolean
|
Operation |
Description |
|
.isAfter(date) |
true if this date is after the argument |
|
.isBefore(date) |
true if this date is before the argument |
|
.isEquals(date) |
true if both dates are equal |
|
.compareTo(date) |
-1, 0, or 1 |
The argument can be an ISO date string or a context path like now or issue.fields.created.
Diff — returns an object with numeric properties
.diff(date) returns an object with all difference units. The argument can be an ISO date string or a context path (e.g. now).
|
Property |
Description |
|
.diff(date).millis |
Difference in milliseconds |
|
.diff(date).seconds |
Difference in seconds |
|
.diff(date).minutes |
Difference in minutes |
|
.diff(date).hours |
Difference in hours |
|
.diff(date).days |
Difference in days |
|
.diff(date).weeks |
Difference in weeks |
|
.diff(date).months |
Difference in months |
|
.diff(date).years |
Difference in years |
|
.diff(date).businessDays |
Difference in business days |
|
.diff(date).prettyPrint |
Human-readable (e.g. "3 days 2 hours") |
|
.diff(date).abs.days |
Absolute (unsigned) day difference |
|
.diff(date).abs.prettyPrint |
Absolute human-readable difference |
Date difference examples with now variable
|
Expression |
Description |
Example Output |
|
smartValue(issue.fields.created.diff(now).abs.days) |
Number of days since creation |
45 |
|
smartValue(issue.fields.created.diff(now).abs.prettyPrint) |
Number of days since creation in human-readable format |
45 days 3 hours |
Chaining Operations
Operations can be chained together. Arithmetic and boundary operations return a date, so you can continue chaining further date operations.
|
Expression |
Description |
|
smartValue(issue.fields.created.plusDays(7).jiraDate) |
Created date + 7 days, formatted as Jira date |
|
smartValue(issue.fields.duedate.startOfMonth.jqlDate) |
First day of the due date's month |
|
smartValue(issue.fields.created.plusMonths(1).withDayOfMonth(1).jqlDate) |
First of next month after creation |
|
smartValue(now.minusDays(30).jiraDate) |
30 days ago from today |
|
smartValue(issue.fields.components.name.join(" OR ")) |
Component names joined with " OR " |