now().day gets the current day today. now().replace(day=1).weekday() gets the first day of the month, as a weekday. For example, if the month started on wednesday, this would return 2, 0 being monday, 1 being tuesday 3 being wednesday. We need to add this value to the current days to properly get the number of weeks. set adjusted = now().day + now().replace(day=1).weekday() adds the 2 values and places the result in a variable (adjusted / 7) | round(0, 'ceil') divides the result by 7 and rounds it up to the whole number.