jQWidgets Forums
jQuery UI Widgets › Forums › Editors › DateTimeInput › minDate setting
Tagged: datetimeinput, jquery date picker
This topic contains 6 replies, has 2 voices, and was last updated by krunch 12 years, 2 months ago.
-
AuthorminDate setting Posts
-
Hi
I’ve adopted a DateTimeInput and want to restrict selection to futures dates only, including today.There are 2 things I don’t understand in minDate setting, I don’t know if I have something wrong or not ..
1- minDate definition
This doesn’t work :
$("#dfixc").jqxDateTimeInput({ theme: theme, width: 130, height: 23, culture: 'fr-FR', firstDayOfWeek: 1, minDate: new Date()});
I have to do that :
$("#dfixc").jqxDateTimeInput('setMinDate', new Date());
2- minDate behavior
With this setting today is greyed in the calendar, I can only select a date from tomorrow. However the keyboard input (on the ‘date’ field of the input) is allowed for today’s date (not yesterday).
So does I need to set the today’s date as minDate or today-1 ?
Thanks by advance
Hi krunch,
To set the minDate, you should use the “setMinDate” method. If you want to set minDate via the minDate property, you should do that:
$('#DateTimeInput').jqxDateTimeInput({ minDate: new $.jqx._jqxDateTimeInput.getDateTime(new Date(2000, 0, 1)) });
The above is from the jqxDateTimeInput API Documentation.
The following shows how to make the minDate to be a specific Date. The minDate will be selectable from the Calendar and also from the input field.
$("#jqxDateTimeInput").jqxDateTimeInput('setMinDate', new Date(2013,2,18,0,0,0));
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi
Theoretically new Date() retrieves the current date, ie 2013/3/18 (?)
So I use this :
$("#dfixc").jqxDateTimeInput('setMinDate', new Date());
And here is what I get :
> keyboard : I can type ’18’, ’19’ into the input field .. I can not type ’17’
> calendar : I can select ’19’, I can not select ’18’ because it’s disabledThat’s why I wonder how to restrict selection to futures dates only, including today ..
Hi krunch,
new Date() retrieves the current Date and Time.
To get only the current Date, you should use:
new Date(2013,2,18,0,0,0));
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThat’s right, there’s no more gap (but minDate setting via the property doesn’t work for me).
Thank you
Hi krunch,
In your code,you set minDate: new Date(). That is not supported syntax for the minDate property.
Below is the correct one:
$(‘#DateTimeInput’).jqxDateTimeInput({ minDate: new $.jqx._jqxDateTimeInput.getDateTime(new Date(2000, 0, 1)) });
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comYes, I’ve understood…
But in my case, with property setting the previous dates are not greyed in the calendar, even if they can not be selected.
That’s what I get with your syntax :$(“#DateTimeInput”).jqxDateTimeInput(
{
theme: theme,
width: 130,
height: 23,
//dropDownHorizontalAlignment: ‘right’,
culture: ‘fr-FR’,
firstDayOfWeek: 1,
minDate: new $.jqx._jqxDateTimeInput.getDateTime(new Date(2013, 2, 19))
});But the method works fine anyway, thank you.
-
AuthorPosts
You must be logged in to reply to this topic.