Going Stellar

Home/Smart values reference

Jira Automation smart value

firstOfTheMonth() and lastOfTheMonth(): Jira smart values

These functions pick a weekday inside the month of a date. firstOfTheMonth gives the first such weekday, lastOfTheMonth the last one and ofTheMonth the nth one. Use them for rules such as a review on the first Monday or a report on the last Friday.

Syntax

{{[date].firstOfTheMonth(input)}}
{{[date].lastOfTheMonth(input)}}
{{[date].ofTheMonth(n, day)}}

Arguments

ArgumentWhat it isRequired
input / dayWeekday number: 1 Monday, 2 Tuesday, 3 Wednesday, 4 Thursday, 5 Friday, 6 Saturday, 7 Sundayyes
nWhich occurrence in the month, for example 2 for the secondyes (ofTheMonth)

Works on

  • Fields: now, created, duedate and other date values
  • Returns: the matching day in the month of the given date, with the time of day kept

Examples

{{now.firstOfTheMonth(1)}}

The first Monday of November 2026.

Result:

2026-11-02T16:02:39.3+0000

Run on Jira Cloud on .

{{now.plusMonths(1).firstOfTheMonth(1)}}

The first Monday of next month: shift the month first, then pick the weekday.

Result:

2026-12-07T16:18:31.4+0000

Run on Jira Cloud on .

{{now.lastOfTheMonth(5)}}

The last Friday of the current month.

Result:

2026-11-27T16:02:39.3+0000

Run on Jira Cloud on .

{{now.ofTheMonth(2, 1)}}

The second Monday of the month.

Result:

2026-11-09T16:02:39.4+0000

Run on Jira Cloud on .

{{issue.duedate.lastOfTheMonth(5).format("dd MMM yyyy")}}

The last Friday of the month of a due date, in a readable format.

Result:

25 Dec 2026

Run on Jira Cloud on .

{{now.firstOfTheMonth(1).toStartOfDay.format("yyyy-MM-dd")}}

The first Monday as a plain date for a comment or a field.

Result:

2026-11-02

Run on Jira Cloud on .

Pitfalls

  • The weekday argument is a number from 1 to 7. firstOfTheMonth(8) and firstOfTheMonth(0) failed with "Failed to get value", and firstOfTheMonth("MON") rendered empty (checked on Jira Cloud, November 2026).
  • ofTheMonth needs both arguments. {{now.ofTheMonth(2)}} rendered empty (checked on Jira Cloud, November 2026).
  • Asking for an occurrence that does not exist did not fail. {{now.ofTheMonth(5, 2)}} in November 2026, which has only four Tuesdays, gave the last Tuesday, the 24th (checked on Jira Cloud, November 2026).
  • The docs write the third function as OfTheMonth in the heading and ofTheMonth in the example. Use the lowercase form from the example.

Sources

  1. Jira smart values: date and time (Atlassian Support)

Markdown version · All smart values