In forms I have two inputs for date ,StartDate input and End date input. I also have datepicker implemented ,
$("#StartDate").datepicker();
datepicker formats it something like: 02/27/2013 which I don't like but ok.
I would like to parse date before putting it in serialized array. Is this good aproach and if it is how can I accoplish this?
How to accomplish that End Date inut is bigger than Start That, and not allow the oppsoite file submitting??
A date-picker of jQuery UI is used to provide a calendar to the user to select the date from a Calendar. This date picker usually connected to a text-box so user selection of date from the calendar can be transferred to the textbox.
If you like to restrict access of users to select a date within a range then there is minDate and maxDate options are available in jQuery UI. Using this you can set the date range of the Datepicker. After defining these options the other days will be disabled which are not in a defined range.
DateTimePicker allows you to define the text representation of a date and time value to be displayed in the DateTimePicker control. The format specified is achieved by the dateTimeFormat property. Default value of this property is M/d/yyyy h: mm tt.
inside the jQuery script code just paste the code. $( ". selector" ). datepicker({ dateFormat: 'yy-mm-dd' });
Try this:
$.datepicker.parseDate('dd/mm/yy', '22/04/2010');
Ref: https://jqueryui.com/datepicker/#date-formats
Once you set a datepicker, yes it does set the date in plain text, but it also retains the underlying date.
http://api.jqueryui.com/datepicker/#method-getDate
var currentDate = $( ".selector" ).datepicker( "getDate" );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With