function getCutOffDate()

in src/weekly/query.ts [16:28]


function getCutOffDate(deliveryDate: Moment) {
	const today = moment().startOf('day');
	const daysUntilDelivery = deliveryDate.diff(today);
	if (daysUntilDelivery <= 0) {
		return deliveryDate;
	}
	/*
	 * We give a grace period so that
	 * the next issue after cancellation is fulfilled
	 * if the cancellation falls between two issues.
	 */
	return deliveryDate.subtract(6, 'days');
}