Skip to content

Commit

Permalink
Fixing month auto-population.
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverzheng committed Oct 10, 2012
1 parent 055426d commit f7ba2a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
<script>
$(function() {
function updateDay() {
var date = new Date($('#year').val(), $('#month').val(), $('#day').val());
var year = parseInt($('#year').val());
var month = parseInt($('#month').val()) - 1;
var day = parseInt($('#day').val());
var date = new Date(year, month, day);
var names = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
$('#dayOfWeek').text(names[date.getDay()]);
}
Expand All @@ -18,7 +21,7 @@
function populateDate() {
var now = new Date();
$('#year').val(now.getFullYear());
$('#month').val(now.getMonth());
$('#month').val(now.getMonth() + 1);
$('#day').val(now.getDate());

updateDay();
Expand Down

0 comments on commit f7ba2a3

Please sign in to comment.