This function returns a timestamp for the next occurence of any given day - based on a given date in a certain time zone.

The timestamp will return 00:00i.e., just the beginning of the day.


nextDayOfTheWeek(timestamp, dayOfTheWeek, timeZone) #Output: Number



Parser expressionDescription


nextDayOfTheWeek(2018/03/01 12:31, {SUNDAY}, LOCAL)


This example returns: 2018/03/04 00:00 taking into account that 2018/03/01 is a Thursday.


nextDayOfTheWeek({issue.created}, {THURSDAY}, LOCAL)


This example might return: 2018/03/08 00:00 taking if the issue was created on 2018/03/01, which is a Thursday



Parameters used in this function

ParameterInput (data type)Description
timestamp

The parameter must be valid timestamp. Usually this value is retrieved from a field (e.g. due date, created date).
dayOfWeek

The parameter must be a valid day. You can use time macros or use the function dayOfTheWeek() to specify the day.
timeZone

The time zone used for the calculation. 


Days might depend on the time zone - it might be Sunday on the west coast of the US while at the same time it's already Monday in Australia. 



This function returns a



Use cases and examples



Parser function cloud
Map(question)
Notes

Workaround

let daysInWeek = [1,2,3,4,5,6,7].map(n => issue.created.plusDays(n).toCalendarDateUTC() );
let days = daysInWeek.map(d=>d.getDay());
let index = days.indexOf(4); //4 is Thursday
daysInWeek[index]







Status
Tech review

Style guide




Short description

Returns a timestamp for the next occurence of any given day.

Output

Available since

Label