Hi there,
I'm currently using two date/time fields and I created a 3rd field (text field - single line) to display the difference in time between the two dates.
Using the prettyPrint feature from Automation from Jira, I got to the point where I set my diff field with
{{issue.customfield_123.diff(issue.customfield_456).prettyPrint}}
and this works returning something like
3 days, 4 hours and 12 minutes
Point is, I'm trying also to get the seconds since the two dates are set via REST Api / timestamp and I'd like to have also that level of details, e.g.
3 days, 4 hours, 12 minutes and 37 seconds
I've found this https://community.atlassian.com/t5/Jira-Service-Management/now-diff-issue-created-prettyPrint-output-is-in-negative/qaq-p/1363669#M50598 where it looks like seconds get displayed, but cannot seem to add them.
Does anyone have a similar experience?
@John Funk @Bill Sheboy just got a feedback from support, apparently this is an outstanding bug that emerged after the transition to the new issue view.
https://jira.atlassian.com/browse/JRACLOUD-76882
Feel free to add a comment / watch the ticket, it would gather interest for its implementation.
Thank you both for your feedback!
Thanks for the follow-up, Marco!
There appear to be several "opportunities" in this area for date/time and the new issue view:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I just tried a diff().prettyPrint I got...
Field diff test: {{issue.created.diff(issue.updated).prettyPrint}}
Field diff test: 288 days 17 hours 59 minutes 4 seconds
So...I am seeing the seconds and I wonder where the punctuation you are observing comes from.
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.
Hey Bill - the only think I can think of is because he is using two custom fields. In your example and in the example in the link above, they are both using a system value (created or now).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill - yes, I'm using two date/time custom field and I set them via Rest API (Jira UI does not allow to set seconds)
About the punctuation: I was just writing down an example, it wasn't an actual copy/paste from Jira :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gotcha, and...Perhaps it's time to chat with your site admin to submit a ticket to support, and confirm if the REST API does/does not support second-granularity, or if this is broken from one of the recent updates: https://support.atlassian.com/contact/#/
Curiously, millisecond and second options are still available for diff() and other date/time functions with advanced edit and automation rules.
When you learn more from the support team, please post back here so the whole community can benefit. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just raised a request, I will let you know the outcome (y)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marco,
Not sure that it will make a difference, but you might try this:
{{issue.customfield_123.jqlDateTime.diff(issue.customfield_456.jqlDateTime).prettyPrint}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, John! I repeated my test with custom date/time fields, including setting one of them to {{now}} immediately before the test. After repeated trials I found that the custom field *never* was set to the seconds value: it always truncated (or perhaps rounded. With a seconds-delta no value is noted.
DevStart=2020-10-29T22:16:00.0+0000; DevDone=2021-09-27T16:35:00.0+0000; Custom Field diff test: 332 days 18 hours 19 minutes
I wonder if this is an API issue, or something else. (I note that with the new issue view, it is no longer possible to set seconds-granularity.)
@Marco Baldelli have you logged the two values you are comparing to ensure they have seconds-granularity and differences?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi guys - yes, I think this will end up being the root cause.
I'm currently running a PUT on /rest/api/3/issue/{issuekey} with
{
"fields": {
"customfield_11947": "2021-09-16T09:11:43.296+0200",
"customfield_11948": "2021-09-16T09:16:15.456+0200"
}
}
but when I run a GET (or I print in the description the actual fields values), I get
"customfield_11947": "2021-09-16T09:11:00.000+0200",
"customfield_11948": "2021-09-16T09:16:00.000+0200",
with seconds and milliseconds set to 0
What's the point of having a timestamp field then? :)
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.