jQuery PickMeUp datepicker: disable array of dates -
I am using a jQuery datepicker plugin.
I have been working at Dotepek, but how to disable the date in it is that my plan is to have an array of dates, which will be disabled on the datepacker calendar.
I had managed to disable a date using the document from the previous version of the plugin (), but I did not know how to add a star array in it.
jQuery
$ (document) .ready (function () {var now2 = new date (); now 2.addDays (-1); now 2.setHours (0,0,0, 0); $ ('Input # cdate') pickmeup ({status: 'right', mode: 'range', render: function (date) {return {disabled}: date.valueOf () == now2.valueOf ()}}}})}}
update
is the code working below (many, many Thanks)
$ (document) .ready (function () {var arDates = [new date ("2014-02-14"). ValueOf (), new date ("2014-02 ValueOf (), New Date ("2014-02-09"). ValueOf ()]; $ ('Input # cdate') pickmeup ({status: 'Right' mode: 'Category', render: Function (date) { (Disabled: arDates.indexOf (date.valueOf ())! = -1}}}}}};
OK, write it down:
ValueOf ()
is one of the methods of the object, in milliseconds (01/01 / Since 1970).
indexOf ()
One way of the object is to check that if any element is a member of an array.
Then your first code is spot, you also have the match:
var arDates = [New date ("2014-02-14"). Value off (), new date ("2014-02-11"). Value off (), new date ("2014-02-09"). ValueOf ()]; Disabled: arDates.indexOf (date.valueOf ())! = -1
You can have a Maybe face with time zone. For example: New date ("2014-02-17")
is not making a date for me on 17th February due to my timezone it goes back 3 hours.
Comments
Post a Comment