Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel

On this page

Table of Contents
maxLevel2
exclude(On this page|Use case).*
stylecircle
typeflat
separatorpipe



UI Text Box
sizemedium
typeinfo

Use case

Update a number field with the difference in days between two dates obtained from two Date Picker fields.


Prerequisites

UI Expand
titleSet up the custom field


UI Steps


UI Step

Create a Number custom field

Name: Time Difference


UI Step

Add it to the screens of your choice.








Configuration

UI Steps


UI Step
Add the post function Update fields to the transition of your choice.


UI Step

Target issue*

Select current issue



UI Step

Fields

UI Steps


UI Step

Field*

Select Time Difference, the field previously created


UI Step

Value*

Select Set field value manually (parser expression) and enter the following expression with the expression editor in Jira expression mode:

Code Block
languagebash
linenumberstrue
((new Date(issue?.customfield_10043  + "T00:00:00").getTime() - new Date(issue?.customfield_10040 + "T00:00:00").getTime())) / 1000 / 60 / 60 /24


UI Text Box
typenote

Replace the field codes of the expression with the ones of your Date Picker fields.


UI Text Box
typeinfo
With the current configuration, this expression will return the number of days between the first date and the second one. In order to display the number of hours, remove /24 from the expression.


UI Expand
titleVariation

If you prefer to use our parsing mode, you can set the expression editor to General mode and create an expression as follows:

Code Block
languagebash
linenumberstrue
%{({issue.cf10001}-{issue.cf10002})/1000 /60 /60 /24}


UI Text Box
typenote

Do not forget to surround the operation with an additional %{}









Related use cases

Page properties report
firstcolumnUse case
headingsJWT feature, Workflow function, Parser functions, Label
sortByTitle
cqllabel = "use-case" and ancestor = "38569498" and space = currentSpace()


Excerpt Include
DECADIS:Contact support
DECADIS:Contact support
nopaneltrue


Page properties
hiddentrue


JWT feature

Workflow function

Update fields

Parser functions
Label
Use case descriptionUpdate a number field with the difference in days between two dates obtained from two Date Picker fields.
Complexity

Status
colourGreen
titleBeginner




Page properties
hiddentrue



Status
Tech review

Status
colourGreen
titledone

Style guide

Status
colourGreen
titledone

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged