Instead of doing the math via the script, I now have it keep track of the milliseconds and the just format that. It'll just add x amount of milliseconds to the current milliseconds and then formats the field.

I also modified the default getRawValue() function. The new getRawValue() will return the milliseconds while the getValue() will return the same formatted time that you see in the field.

Let me know if you like this better. The root post has the updated attachment and the online demo has been updated.

Cleaned up some code. Instead of doing all the formatting by hand, I'm using the date.format() function now. Can't believe I didn't think of that earlier so now it's a lot better! 1 line of code instead of about 30!

Just tested with IE, FF, and Chrome on Win and it changes up and down as expected so can you tell me what your using so I can see what you're seeing?

Originally Posted by Animal

In fact what it is doing is switching from am to pm on every repeat of the click event.

What I have the script to do, and it using the same function for both types just formats it differently, is I get where the cursor is so that I can tell which time to get (hour, minute, second or am/pm), I add x amount of milliseconds to the current milliseconds that is held in a config option, create a new date object and then format it.

I'm not doing any of the math or formatting by hand anymore. Pretty much letting the date function take care of that. Only math is to add x amount of milliseconds. So I'm not sure why it would be switching from am to pm on every click event because it should just be adding milliseconds and then formatting the new date object.

I just made some changes. I have dropped the following functions: getHours(), getMinutes(), and getSeconds(). The reason for this is that I have modified the getValue() function. U can pass a date string that will format the time to whatever u need. This can return just the hours, for example, or u can mix and match some.

Couple of examples:

To get just the hours u can do this
TimeField.getValue('h')

To get the minutes u can do this
TimeField.getValue('i')

To get seconds since. EPOCH
TimeField.getValues('U')

If u check the online demo, I have provided the descriptions and what it would return.