Page 1 of 1

Setting date-time fields

Posted: 17 Feb 2014
by marcwenger
How does one set, in javascript, the date, hour and minute fields? Are there special break characters in a string or Date object? Thanks

Re: Setting date-time fields

Posted: 18 Feb 2014
by Dmitry Kozlov
Hello,

You should pass an array into date and time field:

Code: Select all

fd.field('DateTime').value(['3/19/2014', '9 AM', '40'])

Re: Setting date-time fields

Posted: 09 Apr 2015
by davidnarramore
Can the time range be set? Instead of 24 hours 8am 8pm?

Re: Setting date-time fields

Posted: 10 Apr 2015
by Dmitry Kozlov
Hi,

You can change time format in the regional settings of the site:

Site Settings -> Regional settings -> Time format.

Re: Setting date-time fields

Posted: 10 Apr 2015
by davidnarramore
I am talking about the control on the list forms only showing options from 8am to 8pm. The regional settings are set from 8am to 8pm, but the date time picker still shows full 24 hour time period.

Re: Setting date-time fields

Posted: 13 Apr 2015
by Dmitry Kozlov
Got it. You can remove redundant options with the help of JavaScript:

Code: Select all

fd.field('DateTime').control()._el().find('select:eq(0) > option').filter(function() { return $(this).index() < 8 || $(this).index() > 20 }).remove()
Replace DateTime in the code above with the internal name of you date and time field.