?
Solved

Disable all days except monday on js calendar

Posted on 2013-12-02
2
Medium Priority
?
315 Views
Last Modified: 2013-12-02
Hello!

I need to have all days disabled except monday on my calendar. Any idea how to do this?

Here's my code at the moment....



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

//Now





function nonWorkingDates(date) {
    if( date.getTime() == new Date(2013,1,10,0,0,0).getTime() )  return [true, ''];
      
      var closedDates = [[1, 04, 2013], [06, 05, 2013], [27, 05, 2013], [26, 08, 2013], [25, 12, 2013], [26, 12, 2013],[14, 02, 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
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 2000 total points
ID: 39690510
Can you show more code or a link to a live page?

Without testing, if this works in your current code to disable Sundays...
return [day > 0, '']; // Open if not Sunday

Open in new window

...then I would expect it works for you if you replace that line with:
return [day == 1, '']; // Open if Monday

Open in new window

0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 39690573
Now I tested it, with the JQuery UI datepicker, and it works.
captureEDIT: also put it on my website to test directly: http://schutt.nl/ee/Q_28308112/
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

770 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