Given a date field and a sprint size (10 days), this formula calculates the number of sprints remaining (integer) until the end of the year.
This formula can be used in a Notion formula field.
floor(max((dateBetween(dateAdd(dateAdd(start(prop("Date")), 11 - month(start(prop("Date"))), "months"), 31 - date(start(prop("Date"))), "days"), start(prop("Date")), "days") - dateBetween(end(prop("Date")), start(prop("Date")), "days")), 0) / 10)
Here's an explanation of what is going on:
const lastMonthOfYear = dateAdd(start(prop("Date")), 11 - month(start(prop("Date"))), "months")
const lastDayOfYear = dateAdd(lastMonthOfYear, 31 - date(start(prop("Date"))), "days")
const daysUntilEndOfYear = dateBetween(lastDayOfYear, start(prop("Date")), "days")
const daysRemainingAfterDateRange = max((daysUntilEndOfYear - dateBetween(end(prop("Date")), start(prop("Date")), "days")), 0)
const sprintsRemaining = floor(daysRemainingAfterDateRange / 10)