Solved

Exempt blocked dates on Jscript calendar

Posted on 2013-01-24
2
249 Views
Last Modified: 2013-01-24
I'm using a Jscript calendar on a florist website.

They don't deliver on Sundays so that day is blocked out. However, they do deliver on one sunday -  Mothers day, 10/3/13.

Is there a way to make this one sunday date selectable?

$(function() {
$('#itemname6').datepicker({dateFormat: 'dd/mm/yy', minDate: 1, beforeShowDay: nonWorkingDates});
                                                
     setMinDate(); // Set it now
      setInterval(setMinDate, 60000); // And check every minute
});

//Now


function noSundays(date) {
      return [date.getDay() != 0, ''];
}



function nonWorkingDates(date) {
      
      var closedDates = [[1, 04, 2013], [06, 05, 2013], [27, 05, 2013], [26, 08, 2013], [25, 12, 2013], [26, 12, 2013]],
           day = date.getDay();
           for (var i = 0; i < closedDates.length; i++) {
            if (date.getDate() == closedDates[i][0] && date.getMonth() + 1 == closedDates[i][1] &&
                        date.getFullYear() == closedDates[i][2]) {

                  return [false, '']; // Closed date
            }
      }
      return [day > 0, '']; // Open if not Sunday
}
                                            

Open in new window

0
Comment
Question by:BrighteyesDesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38815674
replace :
function nonWorkingDates(date) {

Open in new window

by :
function nonWorkingDates(date) {
    if( date.getTime() == new Date(2013,2,10,0,0,0).getTime() )  return [true, ''];

Open in new window


test page : http://jsfiddle.net/wVq7R/
0
 

Author Closing Comment

by:BrighteyesDesign
ID: 38815793
Perfect, thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ouput in html in powershell 2 32
Character counter breaks after adding EmojiOne Area 4 49
Change how page is organized 3 36
SVG and IE11 2 17
This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question