Hello!
I need help getting the desired result when using the following JMWE post-function script to return specific days of the week in my custom field's calendar:
Date date = new Date();
int day = date.day;
if (day == 0) {
day = 7;
}
int daysToAdjust = (day <= 2) ? (4 - day) : (2 - day);
return date + daysToAdjust;
Basically, if the current day is thursday, friday, saturday, sunday or monday, it should return the upcoming tuesday, and if the current day is tuesday or wednesday it should return the upcoming thursday.
Now, if the current day is Thursday, this script returns the Tuesday of the current week (past Tuesday) instead of the upcoming one. It should always return the upcoming Tuesday or Thursday.
Any ideas on how to modify this script?
I believe this should work:
int daysToAdjust = (day == 2 || day == 3) ? (4 - day) : (day == 1) ? 1 : (9 - day);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.