JSFiddle - React, Tailwind, and code Playground

by Kato Richardson

HTML

<link rel="stylesheet" href="http://www.eyecon.ro/bootstrap-datepicker/css/bootstrap.css">
<link rel="stylesheet" href="http://www.eyecon.ro/bootstrap-datepicker/css/datepicker.css">
<script src="http://www.eyecon.ro/bootstrap-datepicker/js/jquery.js"></script>
<script src="http://www.eyecon.ro/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
<input type="text" class="span2" value="02-16-2012" id="dp1" >

CSS

.container {
        background: #fff;
    }
    #alert {
        display: none;
    }

JavaScript

$(function() {
    function disableWeekends($this) {
        var $days = $this.find('.datepicker-days tr').each(function() {
            var $days = $(this).find('.day');
            // disable Sunday
            $days.eq(0).addClass('old').click(false);
            // disable Saturday
            $days.eq(6).addClass('old').click(false);
        });

    }

    // create the date picker
    $('#dp1').datepicker({
        format: 'mm-dd-yyyy'
    });

    // get instance of the jQuery object created by
    // datepicker    
    var datepicker = $('#dp1').data('datepicker');

    // disable weekends in the pre-rendered version
    disableWeekends(datepicker.picker);

    // disable weekends whenever the month changes
    var _fill = datepicker.fill;
    datepicker.fill = function() {
        _fill.call(this);
        disableWeekends(this.picker);
    };

});