Simple as it may seem,
set the MinDate to the date - 1 before you set the date.
You will also have a similar problem with the MaxDate and you need to set it
to a value greater than what you will need i.e. set it to date+1 before you
set the Date. The other catch is if the user sets it to an invalid value
outside the range you need to force the date into range in your exception
handler. Also make sure time is set to zero.
DatePicker.Time := 0;
DatePicker.MaxDate := now;
DatePicker.MinDate := now-365;
The other gottya is if your app is running 24 hours a day you may need to
set the MaxDate/MinDate on entry if you are trying to limit the user to
entering dates in a limited range (i.e. today and the last week)
Maurice Butler
Like Magic Ltd
-----Original Message-----
From: Mark Derricutt <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Thursday, 18 February 1999 13:54
Subject: [DUG]: Date Selection Component Madness...
>'lo peoples - I have a really confussing and annoying problem... I have a
>TDateTimePicker component, and I wish to change its MinDate/MaxDate
>properties.....
>
>Just prior to modifying the MinDate property I have:
>
> Date = 2/12/98
> MinDate = 30/12/99
>
>I have no idea where the Date/MinDate value came from as I havn't set them
>yet, however, the moment I try to modify the MinDate property, in this
>case setting it to 1/1/98 - I get an error saying "Date is less than
>MinDate" - how do I get around this????
>
>
>---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz