/    Sign up×
Community /Pin to ProfileBookmark

Jquery datepicker extending

I have managed to get the jquery datepicker almost how I need it, I am not a javascript expert at all. So really need someone who is to help me extend this.

At the moment I can disable a day of the week and also specify holiday dates to disable as well.

What I need to do is to enable certain dates on the sunday through the year, for example next year mothers day 3rd April 2011 I need that to be selectable, and also some other dates. Please help as I am behind schedule.

Here is the code working up to now

[code]

<script type=”text/javascript”>
$(document).ready(function(){

* * $(“#datepicker”).datepicker({
* * * * beforeShowDay: nonWorkingDates,
* * * * numberOfMonths: 1,
* * * * minDate: ‘0’,
* * * * maxDate: ‘+12M’,
* * * * firstDay: 1
* * });

* * function nonWorkingDates(date){
* * * * var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
* * * * var closedDates = [[7, 29, 2009], [8, 25, 2010]];
* * * * var closedDays = [[Sunday]];
* * * * for (var i = 0; i < closedDays.length; i++) {
* * * * * * if (day == closedDays[i][0]) {
* * * * * * * * return [false];
* * * * * * }

* * * * }

* * * * for (i = 0; i < closedDates.length; i++) {
* * * * * * if (date.getMonth() == closedDates[i][0] – 1 &&
* * * * * * date.getDate() == closedDates[i][1] &&
* * * * * * date.getFullYear() == closedDates[i][2]) {
* * * * * * * * return [false];
* * * * * * }
* * * * }

* * * * return [true];
* * }

});
</script>
[/code]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @zimmo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...