Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi,
Context: As of 1st of April July 2024 Jira will limit the amount of worklogs per item (Our worklog is above the max of 5000). We have one project which we use purely for time tracking.
So I'm currently making a automation to create new ticket every half year. In the summary I want the following: "Worktime yyyy-Hh", with yyyy being the year and h being what half of the year.
For the summary of the newly created ticket I have the following formula:
Worktime {{now.format("yyyy")}}-H{{now.format("Q").asNumber.divide(2).ceil}}
Current date is 2024-03-26
now.format("yyyy") => 2024
now.format("Q") => 1
now.format("Q").asNumber => 1
now.format("Q").asNumber.divide(2) => 0 (expected 0.5)
now.format("Q").asNumber.divide(2).ceil => 0 (expected 1)
What formula can I use to achieve this required results?
Thanks in advance!
Greetings,
Ruben
Hi @Ruben Uyterlinde ,
What are H0 and H1? Are they representing the halves of the year?
If so, you can use the following:
{{now.format("yyyy")}}-H{{#if(now.monthOfYear.lte(6))}}1{{/}}{{#if(now.monthOfYear.gt(6))}}2{{/}}
If not, could you please clarify? I'd like to assist.
For math expressions you can check out the doc here.
Tugba
actioner.com
Thanks, nice way to solve it! Variable h was indeed representing havles of years.
Do you get the same result when using these fomula's, just to verify. I consider them bugs and will report them if you get the same result.
now.format("Q").asNumber.divide(2) => 0 (expected 0.5)
now.format("Q").asNumber.divide(2).ceil => 0 (expected 1)
Greetings,
Ruben
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, i am getting the same result.
divide(2) and divide(2).ceil always return 0.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It appears the integer typing follows through to the end of the calculation after the earlier use of the format() function.
Please try using the longer form of the math operations when you want to manage the typing and significant digits:
{{#=}}CEILING ( {{now.format("Q")}} / 2 ){{/}}
Or...
First create a variable with a value of 1.0 and multiply that by the formatted date's quarter before the division. I believe this will force the typing to continue.
{{varOne.asNumber.multiply(now.format("Q").asNumber).divide(2).ceil}}
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.