Setting date-time fields

Discussions about Forms Designer for SharePoint 2010.
Locked
marcwenger
Posts: 17
Joined: Tue Dec 17, 2013

17 Feb 2014

How does one set, in javascript, the date, hour and minute fields? Are there special break characters in a string or Date object? Thanks

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

18 Feb 2014

Hello,

You should pass an array into date and time field:

Code: Select all

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

davidnarramore
Posts: 76
Joined: Wed Jan 21, 2015

09 Apr 2015

Can the time range be set? Instead of 24 hours 8am 8pm?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

10 Apr 2015

Hi,

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

Site Settings -> Regional settings -> Time format.

davidnarramore
Posts: 76
Joined: Wed Jan 21, 2015

10 Apr 2015

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.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

13 Apr 2015

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.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests