?
Solved

Exempt blocked dates on Jscript calendar

Posted on 2013-01-24
2
Medium Priority
?
260 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
2 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Suggested Courses

862 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