Giter Club home page Giter Club logo

timepicker's Introduction

jQuery Timepicker Build Status Gitter chat

A jQuery plugin to enhance standard form input fields helping users to select (or type) times.

Please visit http://timepicker.co for Documentation, Examples and Getting Started information.

Release History

See CHANGELOG.

License

Copyright (c) 2016 Willington Vega Licensed under the MIT, GPL licenses.

timepicker's People

Contributors

billybednar avatar davidsparks avatar ienders avatar joliss avatar madalinignisca avatar sponrad avatar wvega avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timepicker's Issues

highlight field value

When opening the drop down with a value already in the field, the value in the field is not highlighted in the drop down.

order time options properly for field with existing value

Can the timepicker be modified so that it properly sorts the time options for a field with an existing value. Example my timepicker field has a preset value of 2:00pm. When I click in the field I cannot scroll up to select times earlier then 2:00pm. Those earlier times are displayed at the bottom of the list which is confusing for users.

current functionality:
picker1

preferred functionality:
picker2

Remove scrollbars from dropdown

Perhaps we can use something like Facebook's thicker with a scroll indicator that appears when the users uses the keyboard or mouse wheel..

using <div style="display:none"> shows the timepicker in background.

@wvega I have a div tag with attribute set display:none for showing it as a modal dialog window.
if I add the timepicker control to this div it displays it in the background.

As a workaround I have added z-index:1151 !important; to the below css element which worked for me.

.ui-timepicker-standard {
37 /* overwrites .ui-widget /
38 font-family: Verdana,Arial,sans-serif;
39 font-size: 1.1em;
40 /
overwrites .ui-widget-content /
41 background-color: #FFF;
42 border: 1px solid #AAA;
43 color: #222;
44 /
overwrites .ui-menu */
45 margin: 0;
46 padding: 2px;
47 z-index:1151 !important;
47 }

Work with jQuery 1.3

I have tweaked the code to work with jquery 1.3.

Basically, the only 1.4 functionality you are using is delegate().

I'm not very familiar with github, but I can provide the code if needed.

The change needed is moving the mousenter,mouseleave, and click delegate() bindings into the _popuplate method and use bind() instead. First, I tried to make the 1.3 version of live() work, but the problems is that live() is in the document context in 1.3, so the events were being triggered for every timepicker on the page.

[IE] Clicking outside the timepicker after scroll does not hide it

Steps to reproduce:

  • Attach a timepicker to an input and activate it with scrollbars.
  • Scroll without selecting any value
  • click outside the timepicker.

Expected behaviour:

  • The timepicker will disappear.

Actual behaviour:

  • The timepicker persists and cannot be closed without selecting a value.

Affected browsers:

IE10

CSS specificity issues between Timepicker 1.3.2 and jQuery UI 1.11.1

A possible solution could be to replace .ui-timepicker-standard .ui-menu-item with .ui-timepicker-standard .ui-menu .ui-menu-item in plugin stylesheet. Although I believe the calculation of the menu-item width can be improved to look better with this version of jQuery UI.

Use test/visual.html to reproduce.

Input field's change event is not been triggered

Ran into a problem with the update of the time. For some reason it doesn't trigger the input change event when a new value is selected. They added this...

setTime: function (time) {
    var self = this;
    if (time && time.getMinutes) {
        self.element.val($.fn.timepicker.formatTime(self.options.timeFormat, time));
        self.element.trigger("change"); // proposed solution
        self.selectedTime = time;

        if (self.options.change && $.isFunction(self.options.change)) {
            self.options.change(time);
        }
    }
}

Adjust timepicker position in cases where appearing under i.element would be off-screen

In some cases where the viewport space is limited, it may be useful to show the timepicker on top of its target element.

Here is a rough example of some code that would accomplish this:

~line 435:

if(widget.container.offset().top > ($(window).scrollTop() + $(window).height() - widget.container.height())) {
    widget.container.css('top', parseInt(widget.container.css('top'), 10) -  widget.container.height());
} else {
    widget.container.css('top', parseInt(widget.container.css('top'), 10) + i.element.outerHeight());
}

When user clicks on a time entry no time is selected

The text field remains empty (or with previous value). The plugin behaves as expected if the selection is made using the keyboard.

Seen in IE 7.0.6001.18000 (Windows Vista), IE8 (reported)
Unable to reproduce in IE 7.0.5730.13 (Windows XP), IE 9 Beta (Windows 7), Firefox, Chrome and Safari.

Position bug

Hi. I have a problem with timepicker. After first click timepicker shifted to the left by -9px.
I recorded a video http://youtu.be/OG2np1fdnfg
This problem occurs only when you first click after the page loads

Update. If page has vertical scrollbar, all is well

Provide methods to allow options modification

It would be useful to allow users/developers to change options values after the plugin has been initialized.

One suggestion, based on a question posted by @kdixit, is to call timepicker again passing an object with the options to change and their new values:

$('.timepicker').timepicker({ timeFormat: 'hh:mm:ss p' });

I like that. Is there another, better, way?

Use a single UI for all timepickers

Create the UI for the timepicker on demand (the firts time the plugin function is called?) and place it dynamically everytime the menu needs to be shown. Use the same UI for all timepickers.

Change format

I am trying to change the output format of timepicker after it is loaded. i use following..

$('.timepicker').timepicker({ timeFormat: 'hh:mm:ss p' });

which does not seem to be working..

Is there anything i am missing ?

Set z-index attribute for UI

Currently, the timepicker menu it is not displaying for us without changing the z-index attribute.

Capture the z-index of input field the timepicker is attached to and give the timepicker menu the same value.

Chaining doesn't work

Minor issue:

$('.time-field').timepicker().find('...') # this works
$('.time-field').timepicker().timepicker('destroy').find('...') # this doesn't

API methods like 'destroy' seem to return the jQuery object twice, like [$('.time-field'), $('.time-field')].

This is happening on jQuery UI 1.8.20 with jQuery 1.7.2.

I tried digging into the source, but I wasn't able to fix up the return values. I'm not sure why the duplication is happening.

Is this a problem with my app/environment, or can you reproduce it?

Option "now" and format for reading

Hi Wvega.

Thank you for your script. It's very useful.
Can i suggest you to add a "now" option, which takes the server hour by default ?
By format for reading, I mean that you read for example "14h00" on the screen, and the time is recorded to "14:00:00"...
Thank you again.

next() method is not getting fired..!!!

I am working on a functionality same as outlook appointment where on change of start time the end time should change.
On the change event of start time i have written the code to set the next time in the endtime control but the next method does seems to work.
below is the code.

jQuery(function ($) {
   $('#starttime').timepicker({
       scrollbar: true,
       change: function (time) {
           var timepicker = $('#endtime').timepicker(),
               instance = timepicker,
               object = null;
           instance.setTime(time);
           instance.next();
       }
   });
});

jQuery(function ($) {
   $('#endtime').timepicker({
       scrollbar: true,
       change: function (time) {

       }
   });
});

Please help me out.

Time picker does not close on blur

Time picker window does not close on blur. Looks like there is a handler bound to blur.timepicker event but the i.close() call is commented out.

when timeFormat does not have minutes

The interval shouldn't be below 60 when the timeFormat does not have minutes in it.

My patch simply checks if the timeFormat has 'mm' somewhere in it, and if not, sets the interval to 60. Could be further refined by checking if the interval is multiple of 60, then it can stay as it is, but if not then we can set it to the nearest multiple of 60.

Without this if the format has no 'mm' in it and the interval lets say is 15, then the list will contain each hour 4 times.

diff --git a/jquery.timepicker.js b/jquery.timepicker.js
old mode 100644
new mode 100755
index e969a01..68b7125
--- a/jquery.timepicker.js
+++ b/jquery.timepicker.js
@@ -627,6 +627,11 @@ if(typeof jQuery != 'undefined') {
             }

             var globals = $.extend({}, $.TimePicker.defaults, options);
+
+            // the interval should not be smaller than 60 if the timeFormat
+            // does not include minutes
+            if (!/mm/.test(globals.timeFormat))
+              globals.interval = 60;

             return this.each(function() {
                 $.TimePicker.instance().register(this, globals);

Maximum call stack size exceeded

"parseTime()" throws "Maximum call stack size exceeded" if a user enters such value into the textbox "441234567".

If user enters repeating digits in the beginning, and the number of the entire digit is greater than 6, lose focus or tab over, then this error will be thrown.

Interval greather than 60 should be allowed

Also, when interval is 45, to say something, the generated time items are not equally seperated:

  • 07:00 PM
  • 07:45 PM (good, 45 minutes later)
  • 08:00 PM (wrong, 15 minutes later!)

multiple instances

Looks like each call to timepicker still creates a new instance of the timepicker widget.

Odd z-index issue

Not sure if this is a bug or not, but I'm having some z-index issues with the timepicker on a more complicated layout. I have a timepicker that isn't showing inside jquery UI tabs.

The z-index value is coming through in chrome as 'auto' by default.

I've found changing line 584 (default for zindex value) from 'null' to 1 fixes my particular issue.

Any idea why this is happening? Would changing that value have an effect anywhere else?

THANK YOU by the way for the fantastic plugin!

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.