Skip to content

Commit

Permalink
Update bday-picker.js
Browse files Browse the repository at this point in the history
Keeps date format consistent - allows to use posted date as default date in form if needed.
  • Loading branch information
albanR committed May 19, 2013
1 parent 2634aeb commit cf51677
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bday-picker.js
Expand Up @@ -89,6 +89,8 @@
defYear = defDate.getFullYear(),
defMonth = defDate.getMonth() + 1,
defDay = defDate.getDate();
if (defMonth<10) defMonth="0"+defMonth;
if (defDay<10) defDay="0"+defDay;
hiddenDate = defYear + "-" + defMonth + "-" + defDay;
}

Expand Down Expand Up @@ -181,6 +183,8 @@

// update the hidden date
if ((selectedYear * selectedMonth * selectedDay) != 0) {
if (selectedMonth<10) selectedMonth="0"+selectedMonth;
if (selectedDay<10) selectedDay="0"+selectedDay;
hiddenDate = selectedYear + "-" + selectedMonth + "-" + selectedDay;
$(this).find('#'+settings["fieldId"]).val(hiddenDate);
if (settings["onChange"] != null) {
Expand Down

0 comments on commit cf51677

Please sign in to comment.