Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Set a date field to today's date

Abstract

This code snippet sets a date field to today's date 

Logic

Pass today's date

Snippet 

{{ now }}


Context

The output of the code snippet is a Moment.js date object which you could use to:

  • Set a Date/Date-time picker field - Eg: Set the Due date to today in
    • one of the Set Field Value post-functions
    • one of the Transition issue post-functions on the transition screen, if any
    • in the Create issue post-function under Set fields of new issue section

  • Conditionally execute a post-function or Unlink issues - Eg: Estimated delivery date is less than today

    {{ issue.fields["Estimated Delivery Date"] < now }}
  • Notify the customer when the issue has been rejected as invalid through the
    • Comment in one of the Comment issue post-functions

    • Subject/HTML body/Text body of Email issue post-function

      Your issue has been rejected on {{ now | date('dddd, MMMM Do YYYY') }} since it is invalid.
  • Write a JQL search expression in Link issues to current issue post-function. Eg: Link issues which have been created since yesterday

    created >= {{ now | date('subtract' , 1 , 'days') }}

References