Edgewall Software
Modify

Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#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:

Description

As mentioned in comment:61:ticket:10245, add Today and Done buttons to the DatePicker.

Attachments (0)

Change History (8)

comment:1 by Ryan J Ollos, 6 years ago

Resolution: fixed
Status: newclosed

Committed to 1.0-stable in [12421] and merged to trunk in [12422].

comment:2 by Ryan J Ollos, 6 years ago

Keywords: jqueryui added; jquery-ui removed

comment:3 by Ryan J Ollos, 6 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.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

in reply to:  3 comment:4 by Jun Omae, 6 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  
    11jQuery(function($){
     2  var showDatepickerOnClick = function() { $(this).datepicker('show') };
    23  // TRANSLATOR: Format in month heading in the datepicker, extracts yearSuffix
    34  // and showMonthAfterYear
    45  var formatMonth = _("$month$year");
    jQuery(function($){  
    2425    isRTL: false,
    2526    showButtonPanel: true,
    2627    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    }
    2835  });
    2936  $.timepicker.setDefaults({
    3037    // 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 Ryan J Ollos, 6 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.
Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:6 by Ryan J Ollos, 5 years ago

New ticket for issues in comment:3: #11574.

comment:7 by ankitpatel.gusnai@…, 4 years ago

How to click event perform on "Now" button click in datetime picker. Any idea send me code in my email.

Thanks Ankit

in reply to:  7 comment:8 by Ryan J Ollos, 4 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.