wvega / timepicker

A jQuery plugin to enhance standard form input fields helping users to select (or type) times
http://timepicker.co
GNU General Public License v2.0
216 stars 92 forks source link

Option "now" and format for reading #41

Closed serval92 closed 10 years ago

serval92 commented 10 years ago

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.

wvega commented 10 years ago

Hi @serval92,

I have considered the format for reading option myself, so I'm interest in adding it.

Could you please explain how you would use the now option, or how do you expect it to affect the Timepicker's behaviour?

serval92 commented 10 years ago

Hi Wvega. Thanks for the reply. I imagine that : you add this option in script : now:1 And if your computer hour (or server hour) is 08h12, the time by default in the field is 08:12:00... Thank you.

wvega commented 10 years ago

Hi @serval92,

I added a defaultTime option that you can use to define a default value for the time field. You can pass a value as:

  1. A time string. Passing '8:12' will update the field to have the value 08:12 PM (with the default format).
  2. A Date object.
  3. The string 'now', which will use the current time in the users's computer.

If you want to use the server time, you will have to generate that value yourself using code in the backend, and then providing that value as the defaultTime option of the Timepicker. Please take into account that your server time and the user's time may be in different timezones.

Do you think the defaultTime I described above covers what you wanted to achieve with the now option?

wvega commented 10 years ago

I'll add a separated issue for the format for reading option. I need to find the right way to implement that feature.

serval92 commented 10 years ago

Hi wvega.

Thank you so much for your job. It's exactly what I wanted. Thank you again.

wvega commented 10 years ago

Great. Those changes are not available in a new version yet, but you can have access to them downloading a copy of the plugin from the development branch: https://github.com/wvega/timepicker/tree/devel.

I'll try to do a release soon.

serval92 commented 10 years ago

Thank you Willington.

2014-02-17 16:56 GMT+01:00 Willington Vega notifications@github.com:

Great. Those changes are not available in a new version yet, but you can have access to them downloading a copy of the plugin from the development branch: https://github.com/wvega/timepicker/tree/devel.

I'll try to do a release soon.

Reply to this email directly or view it on GitHubhttps://github.com/wvega/timepicker/issues/41#issuecomment-35296345 .