1

In the API here it says:

Trigger to set specified date

{'method'} === set

{'value'} === value to place in input

{'date'} === the date object being used

I want to set the datebox using my Date object variable "nowTime". But it just does not work. In other posts people usually set the datebox by value (which is a string) which is not quite neat at all. Is there any problem with my code? Or is it the datebox's bug?

My Code:

nowTime = new Date();
nowTime.setHours(8);
nowTime.setMinutes(50);
alert(nowTime.toLocaleString());
    
$("#departureTime").trigger('datebox', {'method':'set', 'date':nowTime}).trigger('datebox', {'method':'doset'});

1 Answer 1

1

Works for me if you do the following:

$("#Date1").datebox('setTheDate', nowTime).trigger('datebox', {'method':'doset'});

DEMO

Sign up to request clarification or add additional context in comments.

2 Comments

Right. In API public functions: $('element').datebox('setTheDate', <date>); Set the current date object So what does method "set" with "date" parameter do?
I agree with you that from the API docs what you had should work. Perhaps you can contact the developer and ask.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.