Prevent datetime overflow during date shifting

Note: min(wp.date1 + days, datetime.date.max) cannot be used because
datetime throws an exception when the addition overflows.