jquery - How can I programmatically set the time value in the Anytime datetimepicker widget? -


i think anytime datetimepicker widget cat's meow (or rolls royce's roar (why key elements of anytime jquery plugin blending in background/invisiblized?)),

i implement way:

html

<label for="begindatetime" class="staticlabel">begin date range</label> <input id="begindatetime" name="begindatetime" required="true" /> 

jquery

anytime.picker("begindatetime");  var d8 = new date(); d8.sethours(0); d8.setminutes(0); d8.setseconds(0); $('#begindatetime').val(d8); 

...but, although setting time zilch/midnight works (sort of) @ first:

enter image description here

(actually, want date , time, not gmt jazz, etc.)

...when mash input element invoke/drop down anytime widget, forgets set zilch, , over[rid,writ]es current time:

enter image description here

how can anytime widget preserve value assign when dropped down (until when , if user changes explicitly, of course)?

update

i tried this:

$( "#begindatetime" ).click(function() {     var d = new date();     d.sethours(0);     d.setminutes(0);     d.setseconds(0);     $('#begindatetime').val(d); }); 

...but difference no val appears in input element until click on - still shows zilch, drops down current time...

update 2

i tried this, too:

anytime.picker("begindatetime", { labelhour: "00",   labelminute: "00",   labelsecond: "00" }); 

...but seems nothing.

update 3

ama's answer worked charm. code:

anytime.picker("begindatetime"); // set initial time midnight var convfrom = new anytime.converter(); var d8from = new date(); d8from.sethours(0); d8from.setminutes(0); d8from.setseconds(0); $('#begindatetime').val(convfrom.format(d8from));  anytime.picker("enddatetime"); // set initial time second before midnight var convto = new anytime.converter(); var d8to = new date(); d8to.sethours(23); d8to.setminutes(59); d8to.setseconds(59); $('#enddatetime').val(convto.format(d8to)); 

...resulted in this:

enter image description here

the picker automatically parses initial value input field, must in correct format. easiest way set value use anytime.converter, example:

var conv = new anytime.converter(); var d8 = new date(); d8.sethours(0); d8.setminutes(0); d8.setseconds(0); $('#begindatetime').val( conv.format(d8) ); 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -