Our new Appfire Documentation Space is now live!

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

Add a certain number of days to a date excluding the weekends

Abstract

This code snippet adds a certain number of days to a date excluding the weekends. Currently, when you add a certain number of days to a date the weekends are included. To exclude them, you can use this snippet.

Snippet

{{ <fromDate> | date('businessAdd', <nod> ) | date }}

Placeholders

Placeholder

Description

Example

<fromDate>Date to which the number of days should be addednow
<nod>Number of days to add22

Examples

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 issue created plus 5 days excluding weekends in
    • one of the Set Field Value post-functions
    • in the Create issue post-function under Set fields of new issue section

      {{ issue.fields.duedate | date('businessAdd', 5 ) | date }}
      
  • Notify the customer that the issue will be resolved in 6 days from today through the
    • Comment in one of the Comment issue post-functions
    • Subject/HTML body/Text body of Email issue post-function

      Your issue will be resolved on or before: {{ issue.fields.created | date('businessAdd', 6 ) | date }}

References