Ticket #4045 (closed feature: wontfix)

Opened 6 years ago

Last modified 5 months ago

Datepicker -- Today button enhancement

Reported by: aguita Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.6rc6
Keywords: today Cc:
Blocking: Blocked by:

Description

I'm new to JQuery UI, and I love it. When applying the Datepicker class to my application here at work, I noticed that the Today button simply highlights today's date. The user then would need to click on that date to return the value to the input field. However, I feel that if the user clicks on today's date, most likely that is the date that they want to put into the input field. Therefore, I added that functionality.

I'm not sure if others would need or want this functionality, but I edited my personal version of the jquery.ui.all.js file to include this. I'm giving the code here to the user group in case others would like this functionality.

Cheers!

--Ryan Waterer

/* Action for current link. */
	_gotoToday: function(id) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
			inst.selectedDay = inst.currentDay;
			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
			inst.drawYear = inst.selectedYear = inst.currentYear;
		}
		else {
		var date = new Date();
		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		}
		this._notifyChange(inst);
		this._adjustDate(target);
		//Added by Ryan Waterer on 1/30/2009 to have it return the value 
                //when the person selects the "Today" button
		this._selectDate(id, this._formatDate(inst,
			inst.selectedDay, inst.drawMonth, inst.drawYear));
	},

Change History

comment:1 Changed 6 years ago by joern.zaefferer

  • Milestone changed from TBD to 1.next

comment:2 Changed 6 years ago by imightbewrongbutidontthinkso

This doesn't seem to work in IE7. After you click the Today button, the current date momentarily fills the datepicker text field, but then is immediately removed by the datepicker text field focus.

It does work in Firefox 3.0.10.

comment:3 Changed 4 years ago by Toverbal

I have tried to apply this fix and it seems to work perfectly in IE7, IE8 and IE8 compatibility mode. Also I personally think clicking Today should select today's date instead of displaying the current month. Is there a chance this change will be made, since it has been 18 months ago and 1.next is long overdue since 1.6rc6 :)

comment:4 Changed 4 years ago by pfurbacher

We have gotten feedback from users who are confused as to why "Today" does not select today. I think users expect to select when pressing "Today" because they take the button's label at face value and have experience with other calendars which behave as advertised.

I just did a survey of some other calendars, and "Today" buttons do indeed seem to select today, in addition to snapping back to the current month. As an example, see Apple's pop up calendar on their retail store pages, just above the workshop and event description.

 http://www.apple.com/retail/menlopark/

comment:5 follow-up: ↓ 6 Changed 4 years ago by wojciech

We replaced Prototype based date selector with jQuery UI datepicker. Works great, but new behavior of "Today" button is not acceptable.

comment:6 in reply to: ↑ 5 Changed 4 years ago by justcas

Replying to wojciech:

We replaced Prototype based date selector with jQuery UI datepicker. Works great, but new behavior of "Today" button is not acceptable.

Sorry, did you say, not acceptable? Do you determine that from your userbase, or your own experience? In my view, users have already shown you why they expect such behaviour (not to mention companies much larger then yours), and why the current situation is not sufficiënt.

Your opinion is therefore less relevant, a user interface that follows accepted standards will always be of more importance then the silly personal issues you might have with it.

comment:7 Changed 4 years ago by danheberden

Regardless of how anyone thinks this particular feature should work, I think the obvious solution of writing the function to work the way you need it to is being overlooked.

In the case of the original ticket, outside of jQuery-ui's source one can override the function on the objects prototype.

If the UI widget is using the factory, it would be like

$.ui.accordion.prototype._whateverFunctionToOverride = function() { /* stuff */ };

but in the case of date picker, while the same principle applies, it's not using the widget factory so it's on the jquery object itself

var _gotoToday = $.datepicker._gotoToday;
$.datepicker._gotoToday = function(id) { _gotoToday.call( this, id ); };

For an example of how to use the original bug report's request in use, see  http://jsfiddle.net/danheberden/YgUg8/

Last edited 4 years ago by danheberden (previous) (diff)

comment:8 Changed 4 years ago by romero83

I really do not understand why the datepicker developers cannot invent a new option for to choose today's button behaviour. Our customers prefer the "select today date and hide datepicker" method. But ok, I always have to hack the js after version change. Anyway, I like JQuery UI.

comment:9 Changed 4 years ago by scott.gonzalez

#7093 is a duplicate of this ticket.

comment:10 Changed 2 years ago by scott.gonzalez

  • Type changed from enhancement to feature

comment:11 Changed 2 years ago by scott.gonzalez

  • Milestone changed from 1.next to 1.11.0

comment:12 Changed 2 years ago by mikesherov

  • Status changed from new to open

comment:13 Changed 6 months ago by scott.gonzalez

  • Milestone changed from 1.11.0 to none

comment:14 Changed 5 months ago by scott.gonzalez

  • Status changed from open to closed
  • Resolution set to wontfix

The today button won't exist in the rewrite, instead users will be able to fully customize what buttons exist.

Note: See TracTickets for help on using tickets.