Closed rahulmaxi closed 5 years ago
Hi @rahulmaxi
I'll look into this, might be a case of implementing it via code.
Update: It seems to rely on the system's max date, transferring to standard toolkit for fix.
Hi @Smurf-IV
Is this bug due to the fact that DateTime.MaxValue
is a 32 bit integer?
KryptonDateTimePicker
has a value that is _maxDateTime = DateTime.MaxValue;
which can be changed via
[Category("Behavior")]
[Description("Maximum allowable date.")]
public DateTime MaxDate
DateTime.MaxValue;
according to MSDN is:
The value of this constant is equivalent to 23:59:59.9999999 UTC, December 31, 9999 in the Gregorian calendar, exactly one 100-nanosecond tick before 00:00:00 UTC, January 1, 10000.
BUT
the DateTimePicker.MaximumDateTime
is also in use here!
/// <include file='doc\DateTimePicker.uex' path='docs/doc[@for="DateTimePicker.MaximumDateTime"]/*' />
/// <devdoc>
/// <para>Specifies the maximum date value. This property is read-only.</para>
/// </devdoc>
public static DateTime MaximumDateTime {
get {
DateTime maxSupportedDateTime = CultureInfo.CurrentCulture.Calendar.MaxSupportedDateTime;
if (maxSupportedDateTime.Year > MaxDateTime.Year)
{
return MaxDateTime;
}
return maxSupportedDateTime;
}
}
Which is explained here as to why the value is 9998 (Not really), and also there is a way to "Hack around it" if you must: https://stackoverflow.com/questions/1620858/how-to-set-a-datetimepicker-value-to-datetime-maxvalue
Hi,
Is there anyway DateTimePicker max date can be set to 9999-12-31? At the moment it can be set max to 9998-12-31.
Thanks, Rahul