JQuery Plugin - Date Picker
I am currently attempting to implement the JQuery data picker from http://www.eyecon.ro
I have embedded it in my page without any problems, but I am unable to achieve the functionality I require from it.
The date picker is not attached to a form element, it is purely going to be used as a calendar which will be visible to the user and allow them to scroll through the various months, weeks etc.
The website shows various example of the varying items of functionality - http://www.eyecon.ro/datepicker/#about However, I am only able to achieve the first example shown on the page which displays a years ranging from 2002 - 2013, however, upon load I would like it to display the current month as opposed to the user having to select the correct year, and then month in order to use the calendar.
I am presuming that using the 'date' option there should be a way for me to specify if to display todays date.
Has anyone achie开发者_Python百科ved the above functionality from this plugin?
Thank you.
You can get the current date with:
var today = new Date();
var month = today.getMonth() + 1;
var dateString = today.getFullYear() + '-' + month + '-' + today.getDate();
Note we have to add one to the month, as js counts January as 0.
Edit: reading the docs, the date argument can take a date object - so all you need is:
$('#date').DatePicker({
flat: true,
date: new Date(),
calendars: 1,
starts: 1
});
精彩评论