Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
121 views
in Technique[技术] by (71.8m points)

javascript - How's a "duration picker" called and does it exist?

I'm looking for something like a "duration picker". Because googling "duration picker" doesn't give me any result, I would like to know if there is a technical name for it which can help in searching it. Time picker and Time Span picker doesn't bring anything helpful at the moment.

If something similar exists and someone can point me to that, it's ok instead of the technical name.

Update 1:

Sorry I completely forgot to explain what I mean by duration picker. It's not a time picker, but a way to choose how much time will last doing something, not relative to a date. For example, cooking a given recipe will take (duration) 4 hours and 10 minutes. Traveling from here to there will take 4 days and 10 hours.

My basic idea is the possibility to configure the picker for the "bigger" unit to use (days probably), the duration will be expressed in seconds internally. So I can say 20 days and 23 hours and 0 minutes or if the "bigger" unit is days (for a software development job for example), I can write 150 hours and 30 minutes and 0 seconds. It would be nice the option to hide some smaller fields, like minutes/seconds.

Update 2:

A very simple ui example: enter image description here

question from:https://stackoverflow.com/questions/17428387/hows-a-duration-picker-called-and-does-it-exist

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You could use a set of customized jQuery spinners

 $('#seconds').spinner({
     spin: function (event, ui) {
         if (ui.value >= 60) {
             $(this).spinner('value', ui.value - 60);
             $('#minutes').spinner('stepUp');
             return false;
         } else if (ui.value < 0) {
             $(this).spinner('value', ui.value + 60);
             $('#minutes').spinner('stepDown');
             return false;
         }
     }
 });

like this: http://jsfiddle.net/xHzMw/1/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...