-
23 Jan 2010 3:29 PM #11Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
I have updated the online demo.
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.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Jan 2010 4:51 PM #12
Well, I tested only the demo online and it looks very nice

But is possible to get the minutes, hours, everything you want?
[]'s
-
23 Jan 2010 6:29 PM #13Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
You mean have like a separate function to return just the hours or just the minutes to whatever is being shown? That would be an easy addition if that's what you'd want!
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Jan 2010 6:33 PM #14
Yeah, that's it!
Sometimes you just want to know the hour, if it's am or pm and things like that
[]'s
-
23 Jan 2010 7:22 PM #15Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
@javaman
Check out the online demo! Add a few buttons for ya! Also updated the zip file at the root post.
Anything else ya think of?Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
23 Jan 2010 8:14 PM #16Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
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!
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
24 Jan 2010 12:47 AM #17
The 24 hour one does not change at all. It just flickers.
In fact what it is doing is switching from am to pm on every repeat of the click event.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
24 Jan 2010 7:19 AM #18Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
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?
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.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
24 Jan 2010 8:38 AM #19
A lot of updates, congratulations!
I've tested here, without problems.
I don't know anything more you can do it....hehe
EDIT
You could do a function that we pass an hour and it returns the difference of the hour we passed and the hour of the component.....
[]'s
-
24 Jan 2010 8:43 AM #20Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,107
- Vote Rating
- 453
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.
I have decided to leave the isAM() and isPM() functions.
Let me know if u like this change, it provides flexibility.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote