Skip to content

Commit 7b360ce

Browse files
committed
Don't print lead days.
1 parent eb06cf6 commit 7b360ce

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

datepicker-rewrite/date.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,17 @@ $.date = function ( datestring, formatstring ) {
6666
firstDayOfMonth = new Date(this.year(), date.getMonth(), 1).getDay(),
6767
leadDays = (firstDayOfMonth - calendar.firstDay + 7) % 7,
6868
rows = Math.ceil((leadDays + daysInMonth) / 7),
69-
printDate = new Date(this.year(), date.getMonth(), 1 - leadDays);
69+
printDate = new Date(this.year(), date.getMonth(), 1 - leadDays),
70+
month = date.getMonth();
7071
for (var row = 0; row < rows; row++) {
7172
var week = result[result.length] = {
7273
days: []
7374
};
7475
for (var day = 0; day < 7; day++) {
75-
week.days.push(printDate.getDate());
76+
week.days.push({
77+
lead: printDate.getMonth() != month,
78+
date: printDate.getDate()
79+
});
7680
// use adjust("D", 1)?
7781
printDate.setDate(printDate.getDate() + 1);
7882
}

datepicker-rewrite/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@
6464
<tr>
6565
{{each(index, day) week.days}}
6666
<td class="">
67-
<a class="ui-state-default" href="#">${day}</a>
67+
{{if !day.lead}}
68+
<a class="ui-state-default" href="#">${day.date}</a>
69+
{{/if}}
6870
</td>
6971
{{/each}}
7072
</tr>

0 commit comments

Comments
 (0)