This project has moved and is read-only. For the latest updates, please go here.

The problem about expire time.

Topics: Errors
May 10, 2016 at 9:52 AM
If I set the expire time of a trigger to 31 Dec. 9998 23:59:59, and then click OK to save it.
But if I try to edit this trigger once again, it is a exception showed and cannot edit it.

It seem to all of the datetime picker counter the same problem
May 13, 2016 at 7:51 AM
I found the statement as blow(,85):
        [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
        public static readonly DateTime MaxDateTime = new DateTime(9998, 12, 31);
It seem that the max value of the DateTimePicker is 9998-12-31, so the time older than 9998-12-31 0:00:00 will cause this exception(such as 9998-12-31 1:00:00).

In the source code of "Task Scheduler Managed Wrapper", I find cod as blow in the FullDateTimePicker:
        private void DataToControls()
            DateTime displayTime = currentValue.Kind == DateTimeKind.Utc ? currentValue.ToLocalTime() : currentValue;
            dateTimePickerDate.Value = displayTime.Date;
                       dateTimePickerTime.Value = displayTime;
                       if (!string.IsNullOrEmpty(utcPrompt))
                utcCheckBox.Checked = currentValue.Kind != DateTimeKind.Unspecified;
When the day older than 9998-12-31 0:00:00, "dateTimePickerTime.Value = displayTime;" will throw a exception.

As I know, FullDateTimePicker is wrapper of Date and Time, and "dateTimePickerTime" just to save the time of days. so if change the statement into
dateTimePickerTime.Value = DateTime.Now.Date + displayTime.TimeOfDay;
dateTimePickerTime.Value = dateTimePickerTime.MinDate + displayTime.TimeOfDay;
Maybe the problem will be fixed.

Another option, limit the Datetime input in UI, just not allow to input the Datetime older than 9998-12-31 0:00:00.

Hope it be helpful.
May 13, 2016 at 10:25 PM
Thank you. This helped a great deal. I believe I have this remediated for 2.5.20.
Marked as answer by dahall on 5/13/2016 at 2:26 PM