views:

16698

answers:

11
+12  Q: 

jQuery time picker

I know there are a few plugins out there but I was wondering if anybody here had a preference for any particular one.

I'm looking to fill a text input with a time that the user can choose in 15 minute intervals.

+5  A: 

It's not jQuery ... but I have found that a dropdown, with a list of fifteen minute intervals of time, 8:00AM, 8:15AM, 8:30AM, and so on, is extremely easy for the user to interact with.

Not sure if you really need a jQuery way of doing this ... may be overkill. Just an opinion based on my personal experience with real users and developing business applications.

mattruma
+3  A: 

Check out Maxime Haineault's jQuery.timepicker. Pretty cool, IMHO...

Shog9
cool but horrible to use
Espen
+7  A: 

My advice would be not to do this. I find it bad enough being forced to use a calendar control just to enter a date, especially when not given the option to type a date which I can do way quicker than navigating yet another wacky control.

Time pickers just take this kind of UI fetish to a new extreme. Why not allow your users to either type the time or just use a couple of drop down boxes for hours and mins. Even drop down lists allow a user to just type the time. The time picker in Shog9's answer is all very nice to look at but is incredibly fiddly to use. If I was an end user having to use a data entry app and it had a control like that on the page then it's only going to slow me down and make me want to come and cut off the developers hands. :)

Think about usability first before how slick the app looks.

Just my humble opinion.

Kev

Kev
I'm curious since I was going to use jquery-timepickr myself: The demo at http://code.google.com/p/jquery-utils/wiki/UiTimepickr shows an input field which can be typed into. The timepicker is just an option. would that be a turnoff for your as well?
Adrian Grigore
If you give both options then I have no problem, just as long you don't force users into having to work their way through a date/time picker when there's a perfectly good textbox they could type the date/time into. This applies especially if this is a page used over and over by the same types of users, such as data entry staff or call centre personnel.
Kev
@Adrian Grigore I don't think this works with the latest build (1.8) of jquery.ui... look at issue 41 for more details.
Merritt
-1 because the question is for a timepicker and the accepted answer is "don't". I'm pretty sure there are quite a few plugins that allow manual entry and ui clickness.
dotjoe
@dotjoe - how about citing one of these examples, and one that doesn't come with a raft of usability issues.
Kev
+22  A: 

I found this plugin trumps the other one mentioned. It mimics Google Calendar's timepicker.

Jim Geurts
A: 

My situation was slightly different, I needed a date time picker but couldn't find one either. So I decided to write one. You can find it here http://www.yart.com.au/Resources/Programming/ASP-NET-JQuery-Date-Time-Control.aspx

Petras
A: 

The best I have ever used is the one offered by Telerik.

http://demos.telerik.com/aspnet-ajax/calendar/examples/datetimepicker/overview/defaultcs.aspx

It is unobtrusive, letting the user just enter in the time or click on the clock icon to select from a list. Basically just a more aesthetically appealing method of using editable drop downs.

Merritt
too bad there isn't a version for asp.net mvc
Adrian Grigore
there is http://demos.telerik.com/aspnet-mvc/DatePicker
Merritt
And I don't work for Telerik. I like some of there stuff, other stuff I loathe. For instance, RadWindow. Bleh.
Merritt
A: 

The Any+Time™ DatePicker/TimePicker AJAX Calendar Widget allows time selection which, when using the mouse, is about as fast as typing by hand, but has the added benefit of error prevention. The time can be formatted any way necessary. It also supports keyboard manipulation, although admittedly the keyboard access is not as quick as the mouse or typing... but again, it guarantees the value will be in the required format. It's also easy-to-customize and can handle dates as well.

Andrew M. Andrews III
+3  A: 

If you are interested in using a good time parser and allowing the user to enter in a wide range of valid time strings (8:00 AM, 8AM, 8a, 8, etc), take a look at http://www.datejs.com/.

Here is the jquery code I am using to work with it.

$('.time').blur(function (e) {
    var val = $(this).val();
    if (!isNaN(val))
        // add minutes to numeric value or it will be interpreted as a date
        val = val + ':00'); 
    var dt = Date.parse(val);
    $(this).val(dt.toString('h:mm tt'))
});
Brian
A: 

For those jquery ui lovers out there. Here's the best answer I have found. It supplements the existing jquery ui datepicker. It allows the user to either input into the textbox manually, or use the jquery ui sliders to select the time and date. If you're already using the jquery framework Plus it's fairly lightweight compared to all these other options.

mark
is there a link?
David Radcliffe
A: 

I wrote one based off of the plugin Jim mentioned (works like google calendar time picker) but it works using jquery ui autocomplete. It is MUCH more stable than the afore mentioned plugin. I had issues with that one positioning itself on the page. The plugin takes an array, time range and intervals or an ajax source... so you can customize it to your hearts content.

hazmat
sounds interesting. do you have a demo site for the plugin?
Adrian Grigore
I don't yet, but I do use it on my site. You can go to http://snirk.snirk.com/ and click on an unschedule block. It will bring up a dialog that uses the plugin (the Start Time).
hazmat
A: 

Wrote a very simple one (no config): http://plugins.jquery.com/project/jqmtp

Rotem Tamir
is there a demo site for the plugin?
Adrian Grigore