override increments on datetime field

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have a use case where users need to record the exact minute a vehicle arrived / departed at its destination - we are using a datetime field for this. However the default increment for the time portion of this field is 5mins.

I am using a custom field renderer to try and override the increment values, and I was hoping that by adding 1 minute to the existing time (whatever that happens to be) the UI would be forced to re-render the time picklist in 1 min increments.

But...unfortunately its only adding in the '01' to the list, and the rest remains in 5 min increments - see below:

 

Here is the custom field renderer:
var field = arguments[0],        
value = skuid.utils.decodeHTML(arguments[1]),
   $ = skuid.$;
console.log(value);
var jsDate = skuid.time.parseSFDateTime(value);
jsDate.setMinutes(jsDate.getMinutes() + 1);
value = skuid.time.getSFDateTime(jsDate);
console.log(value);
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);

Is it possible to force the time portion to be rendered in 1 minute increments? This is fairly critical functionality for us as this value ends up being merged into a document for the customer.

Thanks.
Photo of Greg Jarrett

Greg Jarrett

  • 3,496 Points 3k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Official Response
As of Banzai, there's no need to use a custom field renderer to do this, you can set the increment declaratively from the "Advanced" properties of the Datetime field -- change the "Minute Picker Increment" property to 1 and you'll have what you're looking for!