Added getValue method. Update documentation

This commit is contained in:
Chupurnov Valeriy 2016-02-19 14:36:02 +05:00
parent cb8086ebfc
commit d7666521eb
8 changed files with 97 additions and 22 deletions

View File

@ -1,8 +1,7 @@
{
"name": "datetimepicker",
"version": "2.4.8",
"version": "2.4.9",
"main": [
"build/jquery.datetimepicker.full.js",
"build/jquery.datetimepicker.full.min.js",
"jquery.datetimepicker.css"
],

View File

@ -575,7 +575,7 @@ var DateFormatter;
}
};
})();/**
* @preserve jQuery DateTimePicker plugin v2.4.8
* @preserve jQuery DateTimePicker plugin v2.4.9
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy (<chupurnov@gmail.com>)
*/
@ -1417,8 +1417,9 @@ var DateFormatter;
});
};
$.fn.datetimepicker = function (opt) {
var KEY0 = 48,
$.fn.datetimepicker = function (opt, opt2) {
var result = this,
KEY0 = 48,
KEY9 = 57,
_KEY0 = 96,
_KEY9 = 105,
@ -1477,13 +1478,12 @@ var DateFormatter;
timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
timebox = $('<div class="xdsoft_time_variant"></div>'),
applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
/*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
scroller = $('<div class="xdsoft_scroller"></div>'),*/
monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
triggerAfterOpen = false,
XDSoft_datetime,
//scroll_element,
xchangeTimer,
timerclick,
current_time_index,
@ -1575,6 +1575,10 @@ var DateFormatter;
}
});
datetimepicker.getValue = function () {
return _xdsoft_datetime.getCurrentTime();
};
datetimepicker.setOptions = function (_options) {
var highlightedDates = {},
getCaretPos = function (input) {
@ -2756,7 +2760,8 @@ var DateFormatter;
ctrlDown = false;
}
});
return this.each(function () {
this.each(function () {
var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
if (datetimepicker) {
if ($.type(opt) === 'string') {
@ -2785,6 +2790,10 @@ var DateFormatter;
$input = datetimepicker.data('input');
$input.trigger('blur.xdsoft');
break;
default:
if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
result = datetimepicker[opt](opt2);
}
}
} else {
datetimepicker
@ -2800,6 +2809,8 @@ var DateFormatter;
}
}
});
return result;
};
$.fn.datetimepicker.defaults = default_options;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "datetimepicker",
"version": "2.4.8",
"version": "2.4.9",
"title": "jQuery Date and Time picker",
"description": "jQuery plugin for date, time, or datetime manipulation in form",
"keywords": [

53
doc.tpl
View File

@ -940,3 +940,56 @@ jQuery(function(){
</tr>
</tbody>
</table>
<hr>
<h2 id="methods">Methods</h2>
<h3>show</h3>
<p>Show Datetimepicker</p>
<pre><code data-language="javascript">$('#input').datetimepicker();
$('button.somebutton').on('click', function () {
$('#input').datetimepicker('show');
});</code></pre>
<h3>hide</h3>
<p>Hide Datetimepicker</p>
<pre><code data-language="javascript">$('#input').datetimepicker();
$(window).on('resize', function () {
$('#input').datetimepicker('hide');
});</code></pre>
<h3>toggle</h3>
<p>Sgow/Hide Datetimepicker</p>
<pre><code data-language="javascript">$('#input').datetimepicker();
$('button.trigger').on('click', function () {
$('#input').datetimepicker('toggle');
});</code></pre>
<h3>destroy</h3>
<p>Destroy datetimepicker</p>
<pre><code data-language="javascript">$('#input').datetimepicker();
$('#input').datetimepicker('destroy');
</code></pre>
<h3>reset</h3>
<p>Reset datetimepicker's value</p>
<pre><code data-language="javascript">$('#input').datetimepicker();
$('#input').val('12/01/2006');
$('#input')
.datetimepicker('show')
.datetimepicker('reset')
</code></pre>
<h3>validate</h3>
<p>Validate datetimepicker's value </p>
<pre><code data-language="javascript">$('#input').datetimepicker();
$('#input').datetimepicker(validate)
</code></pre>
<h3>setOptions</h3>
<p>Set datetimepicker's options </p>
<pre><code data-language="javascript">$('#input').datetimepicker({format: 'd.m.Y'});
$('#input').datetimepicker('setOptions', {format: 'd/m/Y'});
//or
$('#input').datetimepicker({format: 'd/m/Y'});
</code></pre>
<h3>getValue</h3>
<p>Get current datetimepicker's value (Date object) </p>
<pre><code data-language="javascript">$('#input').datetimepicker();
$('button.somebutton').on('click', function () {
var d = $('#input').datetimepicker('getValue');
console.log(d.getFullYear());
});
</code></pre>

View File

@ -1,5 +1,5 @@
/**
* @preserve jQuery DateTimePicker plugin v2.4.8
* @preserve jQuery DateTimePicker plugin v2.4.9
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy (<chupurnov@gmail.com>)
*/
@ -841,8 +841,9 @@
});
};
$.fn.datetimepicker = function (opt) {
var KEY0 = 48,
$.fn.datetimepicker = function (opt, opt2) {
var result = this,
KEY0 = 48,
KEY9 = 57,
_KEY0 = 96,
_KEY9 = 105,
@ -901,13 +902,12 @@
timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
timebox = $('<div class="xdsoft_time_variant"></div>'),
applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
/*scrollbar = $('<div class="xdsoft_scrollbar"></div>'),
scroller = $('<div class="xdsoft_scroller"></div>'),*/
monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
triggerAfterOpen = false,
XDSoft_datetime,
//scroll_element,
xchangeTimer,
timerclick,
current_time_index,
@ -999,6 +999,10 @@
}
});
datetimepicker.getValue = function () {
return _xdsoft_datetime.getCurrentTime();
};
datetimepicker.setOptions = function (_options) {
var highlightedDates = {},
getCaretPos = function (input) {
@ -2180,7 +2184,8 @@
ctrlDown = false;
}
});
return this.each(function () {
this.each(function () {
var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
if (datetimepicker) {
if ($.type(opt) === 'string') {
@ -2209,6 +2214,10 @@
$input = datetimepicker.data('input');
$input.trigger('blur.xdsoft');
break;
default:
if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
result = datetimepicker[opt](opt2);
}
}
} else {
datetimepicker
@ -2224,6 +2233,8 @@
}
}
});
return result;
};
$.fn.datetimepicker.defaults = default_options;

View File

@ -1,6 +1,6 @@
{
"name": "jquery-datetimepicker",
"version": "2.4.8",
"version": "2.4.9",
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
"main": "jquery.datetimepicker.js",
"scripts": {