1. When your calendar control have the date value as
DateTime.MinValue
, this exception will be thrown, because you are trying to subtract 1 from min value. See details
here.[
^]
2. The solution is to manage this case, and you have two options:
a) Init your calendar control with a value in your code before its first use;
b) Manage the special case by using IF and testing if the current value is
DateTime.MinValue
and in this case do not perform the subtraction.