Skip to content

Commit eedfe4b

Browse files
trentrichardson#633 - add timeOnlyShowDate option to show the date but only allow timepicker
1 parent 7740c23 commit eedfe4b

5 files changed

+14
-6
lines changed

dist/index.html

+3
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ <h3>Other Options</h3>
337337
<dt>timeOnly</dt>
338338
<dd><em>Default: false</em> - Hide the datepicker and only provide a time interface.</dd>
339339

340+
<dt>timeOnlyShowDate</dt>
341+
<dd><em>Default: false</em> - Show the date and time in the input, but only allow the timepicker.</dd>
342+
340343
<dt>onSelect</dt>
341344
<dd><em>Default: null</em> - Function to be called when a date is chosen or time has changed (parameters: datetimeText, datepickerInstance).</dd>
342345

dist/jquery-ui-timepicker-addon.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
this._defaults = { // Global defaults for all the datetime picker instances
4949
showButtonPanel: true,
5050
timeOnly: false,
51+
timeOnlyShowDate: false,
5152
showHour: null,
5253
showMinute: null,
5354
showSecond: null,
@@ -897,9 +898,9 @@
897898
// return;
898899
//}
899900

900-
if (this._defaults.timeOnly === true) {
901+
if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
901902
formattedDateTime = this.formattedTime;
902-
} else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
903+
} else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
903904
formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
904905
}
905906

dist/jquery-ui-timepicker-addon.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/docs/options.html

+3
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ <h3>Other Options</h3>
203203
<dt>timeOnly</dt>
204204
<dd><em>Default: false</em> - Hide the datepicker and only provide a time interface.</dd>
205205

206+
<dt>timeOnlyShowDate</dt>
207+
<dd><em>Default: false</em> - Show the date and time in the input, but only allow the timepicker.</dd>
208+
206209
<dt>onSelect</dt>
207210
<dd><em>Default: null</em> - Function to be called when a date is chosen or time has changed (parameters: datetimeText, datepickerInstance).</dd>
208211

src/jquery-ui-timepicker-addon.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
this._defaults = { // Global defaults for all the datetime picker instances
5555
showButtonPanel: true,
5656
timeOnly: false,
57+
timeOnlyShowDate: false,
5758
showHour: null,
5859
showMinute: null,
5960
showSecond: null,
@@ -903,9 +904,9 @@
903904
// return;
904905
//}
905906

906-
if (this._defaults.timeOnly === true) {
907+
if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
907908
formattedDateTime = this.formattedTime;
908-
} else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
909+
} else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
909910
formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
910911
}
911912

0 commit comments

Comments
 (0)