#11435 closed enhancement (fixed)
Add today and done buttons to the datepicker
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.2 |
Component: | general | Version: | |
Severity: | normal | Keywords: | jqueryui datepicker |
Cc: | Branch: | ||
Release Notes: |
Added Today and Done buttons to the datepicker. |
||
API Changes: | |||
Internal Changes: |
Description
As mentioned in comment:61:ticket:10245, add Today and Done buttons to the DatePicker.
Attachments (0)
Change History (8)
comment:1 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 11 years ago
Keywords: | jqueryui added; jquery-ui removed |
---|
follow-up: 4 comment:3 by , 11 years ago
There is still the issue mentioned in comment:63:ticket:10245, which is present after an upgrade to jQuery UI 1.8.24 and the DateTimePicker 1.4.3. I'm not sure if either behavior is a defect, but the inconsistency is not desirable.
The datetimepicker stays visible after clicking Now until the field it is bound to loses focus. Maybe it should be expected to close. The datepicker disappears after clicking Today and will not reappear until putting the focus elsewhere and then back to the element that the datepicker is bound to. It seems reasonable that the datepicker might disappear after clicking Today, but it is a little strange the clicking the mouse in the field doesn't cause it to reappear.
comment:4 by , 11 years ago
The datetimepicker stays visible after clicking Now until the field it is bound to loses focus. Maybe it should be expected to close.
Related issue is https://github.com/trentrichardson/jQuery-Timepicker-Addon/issues/224.
The datepicker disappears after clicking Today and will not reappear until putting the focus elsewhere and then back to the element that the datepicker is bound to. It seems reasonable that the datepicker might disappear after clicking Today, but it is a little strange the clicking the mouse in the field doesn't cause it to reappear.
Workaround.
-
trac/htdocs/js/jquery-ui-i18n.js
diff --git a/trac/htdocs/js/jquery-ui-i18n.js b/trac/htdocs/js/jquery-ui-i18n.js index c4d35dc..3855254 100644
a b 1 1 jQuery(function($){ 2 var showDatepickerOnClick = function() { $(this).datepicker('show') }; 2 3 // TRANSLATOR: Format in month heading in the datepicker, extracts yearSuffix 3 4 // and showMonthAfterYear 4 5 var formatMonth = _("$month$year"); … … jQuery(function($){ 24 25 isRTL: false, 25 26 showButtonPanel: true, 26 27 showMonthAfterYear: formatMonth.indexOf('$month') > 27 formatMonth.indexOf('$year') 28 formatMonth.indexOf('$year'), 29 beforeShow: function(text, datepicker) { 30 $(datepicker.input).off('click', showDatepickerOnClick); 31 }, 32 onClose: function(text, datepicker) { 33 $(datepicker.input).on('click', showDatepickerOnClick); 34 } 28 35 }); 29 36 $.timepicker.setDefaults({ 30 37 // TRANSLATOR: Heading of the standalone timepicker
The datetimepicker has the same issue. Pressing ESC key would close the picker and leave focus on the input. However, beforeShow
and onClose
handlers for datetimepicker don't work using $.timepicker.setDefault
.
comment:5 by , 11 years ago
Thanks, that seems to work well. Two questions:
- Should we hide the Timepicker after clicking Now?
- For both Datepicker and Timepicker, should the focus be placed on the element it is bound to after clicking Done, and for the Datepicker should the focus be placed on the element after selecting a date? That would allow tabbing to the next field.
follow-up: 8 comment:7 by , 9 years ago
How to click event perform on "Now" button click in datetime picker. Any idea send me code in my email.
Thanks Ankit
comment:8 by , 9 years ago
Replying to ankitpatel.gusnai@gmail.com:
How to click event perform on "Now" button click in datetime picker. Any idea send me code in my email.
You can take a look at the timepicker documentation or ask on the MailingList.
Committed to 1.0-stable in [12421] and merged to trunk in [12422].