Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/MonthPicker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-ui-month-picker",
"description": "jQuery UI Month Picker Plugin",
"version": "3.0.2",
"version": "3.0.3",
"license": "GPL-3.0",
"repository": "https://github.com/KidSysco/jquery-ui-month-picker.git",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/MonthPicker.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
The jQuery UI Month Picker Version 3.0.2
The jQuery UI Month Picker Version 3.0.3
https://github.com/KidSysco/jquery-ui-month-picker/

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Expand Down
24 changes: 16 additions & 8 deletions src/MonthPicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
The jQuery UI Month Picker Version 3.0.2
The jQuery UI Month Picker Version 3.0.3
https://github.com/KidSysco/jquery-ui-month-picker/

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Expand Down Expand Up @@ -166,7 +166,7 @@ along with this program. If not, see
}

$.MonthPicker = {
VERSION: '3.0.1', // Added in version 2.4;
VERSION: '3.0.3', // Added in version 2.4;
i18n: {
year: 'Year',
prevYear: 'Previous Year',
Expand Down Expand Up @@ -528,7 +528,7 @@ along with this program. If not, see

Clear: function () {
this.element.val('');
this._updateAlt(0, '');
$(this.options.AltField).val('');
this._validationMessage.hide();
},

Expand Down Expand Up @@ -648,10 +648,14 @@ along with this program. If not, see
_setSelectedMonth: function (_selMonth) {
var month = _encodeMonth(this, _selMonth), _el = this.element;

if (!month) {
_el.val( '' );
if (month) {
var date = new Date( _toYear(month), month % 12, 1 );
_el.val( this._formatMonth( date ) );

this._updateAlt(0, date);
this._validationMessage.hide();
} else {
_el.val( this._formatMonth( new Date( _toYear(month), month % 12, 1)) );
this.Clear();
}

this._ajustYear(this.options);
Expand Down Expand Up @@ -840,11 +844,15 @@ along with this program. If not, see
this._titleButton.jqueryUIButton({ label: this._i18n('year') + ' ' + this._pickerYear });
},

// When calling this method with a falsy (undefined) date
// value, this.element.val() is used as the date value.
//
// Therefore it's important to update the input field
// before calling this method.
_updateAlt: function (noop, date) {
// False means use the fields value.
var _field = $(this.options.AltField);
if (_field.length) {
_field.val(this._formatMonth(date, this.options.AltFormat));
_field.val( this._formatMonth(date, this.options.AltFormat) );
}
},

Expand Down