Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,473
Community Members
 
Community Events
176
Community Groups

Advanced date compare to get current half year

Hello,

i need to write an automation for an internal control system that opens control tickets with different frequencies. For this purpose, it reads the stored frequency from a customfield of a control datasheet ticket. The options are daily, weekly, monthly, etc.. Now I have to open a control activity issue, which contains, depending on the frequency, the day, the week, the quarter or the information whether one is in the 1st or 2nd half of the year in the ticket summary. Unfortunately, it seems there is no easy way to get the half-year. Therefore I used if else functions, which compare {{now}} with the date 01.07 and if the date is before 01.07 1st half year is used and starting from the 01.07 the 2nd half year. Currently I use: {{now.compareTo(now.withMonth(7).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withMillis(0))}}
Is there possibly an easier way here? Except to build own automations for both half year options, which run on 01.01 or 01.12.

2 answers

0 votes
Stefan Salzl Community Leader Mar 08, 2022

Hi @systems-intern ,

for deeper understanding and analyze please consider to also provide further information in the form of screenshots of eg. issues, current automation rule,...

From what you wrote at the end (the compare date regard 1st or 2nd half of the year):

would the following solve that in an easier fashion:

{{[date1].isBefore([date2])}}

see also:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#--

or did i get something wrong?

Best
Stefan

You can get the number of month by doing something like: 

{{now.monthOfYear}}

So you can do something like

{{#if(now.monthOfYear.gt(6))}} Second half of year {{/}}

correction of the last sentence: i meant 01.01 and 01.07 :)

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events