Skip to content

Commit

Permalink
fixes #384: year dropdown appears before month
Browse files Browse the repository at this point in the history
  • Loading branch information
amsul committed Apr 13, 2014
1 parent a1a43e4 commit d940c6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
7 changes: 4 additions & 3 deletions lib/picker.date.js
Expand Up @@ -1008,7 +1008,9 @@ DatePicker.prototype.nodes = function( isOpen ) {


// Create the month label.
createMonthLabel = function( monthsCollection ) {
createMonthLabel = function() {

var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull

// If there are months to select, add a dropdown menu.
if ( settings.selectMonths ) {
Expand Down Expand Up @@ -1109,8 +1111,7 @@ DatePicker.prototype.nodes = function( isOpen ) {
return _.node(
'div',
createMonthNav() + createMonthNav( 1 ) +
createMonthLabel( settings.showMonthsShort ? settings.monthsShort : settings.monthsFull ) +
createYearLabel(),
( settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel() ),
settings.klass.header
) + _.node(
'table',
Expand Down
14 changes: 7 additions & 7 deletions tests/dev/date.htm
Expand Up @@ -41,8 +41,8 @@ <h3><label for="input_01">Pick a date. Go ahead...</label></h3>
name="date"
type="date"
autofocus
value="14-08-08"
data-value="2014-08-08">
valuee="14-08-08"
data-valuee="2014-08-08">
<br><br><br><br><br>
<button type="button">Disable all dates</button>
<input class="button" type="submit" value="open">
Expand All @@ -60,15 +60,15 @@ <h3><label for="input_01">Pick a date. Go ahead...</label></h3>
<script type="text/javascript">

var $input = $( '.datepicker' ).pickadate({
format: 'yy-mm-dd',
formatSubmit: 'yyyy-mm-dd',
hiddenName: true,
// format: 'yy-mm-dd',
// formatSubmit: 'yyyy-mm-dd',
// hiddenName: true,
selectYears: true,
selectMonths: true
})

var picker = $input.pickadate('picker')

console.log($input.pickadate('get', 'select'))

// $('button').on('click', function() {
// picker.set('disable', true);
// });
Expand Down

0 comments on commit d940c6b

Please sign in to comment.