How can i subtract 2 dates when one of them is nullable?
public static int NumberOfWeeksOnPlan(User user)
{
DateTime? planStartDate = user.PlanStartDate; // user.PlanStartDate is: DateTime?
TimeSpan weeksOnPlanSpan;
if (planStartDate.HasValue)
weeksOnPlanSpan = DateTime.Now.Subtract(planStartDate); // This line is the problem.
return weeksOnPlanSpan == null ? 0 : weeksOnPlanSpan.Days / 7;
}