views:

83

answers:

1

hi,

i am using jquery date and time picker in one my project where users can create an event. in the jquery datepicker, i have the option to select the today's date and future date and not the past date which is good for an event creattion website. but i am stuck with the time picker. for example, if i am in the event creation page(assume now time is 9.30am) and select date as 2010-08-05, then i click on the time field but the time field shows time that is already past i.e. time before 9.30, i cannot allow user to choose time that is before the current time. how can i valdiate this? or is there any way not to show the past time? I am using php, if i decide to validate using php, how i am supposed to validate, which time I should use as base to check the user selected time? users can come from any country so how i am supposed to know which is past time for an user.

I use this http://labs.perifer.se/timedatepicker/, I use the first option and I can use the last option where users allowed to enter two fields which is good as we can know the duration and good thing is second field works based on the i/p in the first field but still this doesnt solve my past time issue.

please let me know if i am not clear.

regards

A: 
>> users can come from any country so how i am supposed to know which is past time for an user.

If I understand you well, the best way is to check at the client side(in javascript).
Here is the sample code .

$("#time").timePicker({
  startTime:new Date() // pass the current time
});​

Then, the timePicker will omit the past and start from the current time.

Kai
hi, thanks. this is what i have [code] $(document).ready(function() { $("#time1").timePicker({ show24Hours: false, separator: '.', step: 15});});[code]i added what you said right below timepicker({but that's just showing the current time and nothing more than that. am i missing anything?
gan
i think it's showing nothing and not the current time as i said.
gan
this works but not sure if it's a correct idea to show the current time and the future time.$(document).ready(function() { $("#time1").timePicker({ startTime: new Date(), separator: '.', step: 15});});
gan
sorry to keep adding comments, not sure if this idea is right because the plugin add 30 minutes step so if current time is 12:28 then it adds 30 and the intervals starts as 12:58 and so on, which looks weird as one cannot set something like 1:00 etc.
gan
this is not the right solution as if select the event date as 2 days from now, the time pickr is going to start only from the current time, which is not right, can someone please advise me?any php validation possible for the time they pick?
gan