Sunday only on Jquery Datepicker?

datepicker, javascript, jquery

Solution

`Date.getDay()` returns a value in the range `0-6`, not `1-7`.

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

Problem

AIM: TO only allow users to select sunday on the datpicker calendar. Currently I have it almost done, except for some reason every other day except Sunday works. When I use 7 for Sunday in the code below the entire calendar is unclickable, any other day works perfect. ``` $(document).ready(function() { $("#datepicker2").datepicker({ autoSize: true, // automatically resize the input field altFormat: 'yy-mm-dd', // Date Format used firstDay: 1, // Start with Monday beforeShowDay: function(date) { return [date.getDay() == 7,''];}}); // Allow only one day a week }); ``` Question: How can I only allow Sunday selection?

Original source