display text in a field less right 8 characters

  • 1
  • Question
  • Updated 5 years ago
  • Answered
How do I present text in a date/ time field displaying only the date, or - right 8 characters?

Photo of Cabot


  • 180 Points 100 badge 2x thumb

Posted 5 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,828 Points 20k badge 2x thumb
Skuid uses the JQuery date control  (see http://api.jqueryui.com/datepicker/)  and you can create a custom date formatting.  Here is an example inline snippet: 

var $ = skuid.$;
var field = arguments[0];
var value = arguments[1];
var jsdate = new Date();

//use skuid util to change SF date to JS date
jsdate = skuid.time.parseSFDate(value);

//uses jQuery UI Datepicker.formatDate tools
skuid.ui.fieldRenderers.TEXT[field.mode](field, $.datepicker.formatDate( "mm/dd/yy", jsdate));

The key text is in the last line.   $.datepicker.formatDate(  XXX , jsdate  )      Use the Datepicker documentation linked above to find other options for formatting dates. 

You can do similar things with strings,  manipulating them so only certain sections of the string show.