I am currently having fun formatting a Content by Search web part in SharePoint 2013, but the formatting of individual values (through Property Mappings) has got me properly stuck.
I already have myself a custom Control_Custom.js and Item_Custom.js using the HTML display templates but there doesn't seem to be anything in there that governs how these property mappings are formatted / rendered.
Lets take a look at the formatting of a Date/Time field which always outputs in the format "dddd, MMMM d, yyyy".
For example - Tuesday, February 5, 2013
I have tried pulling through various different Property Mappings into my Content by Search including both:
- Created
- CreatedOWSDATE
Both of these output exactly the same format.
I ran into exactly the same problem when trying to work with user accounts (say, show the person who last edited a document, or wrote a blog post).
With Person fields the formatting appears to always output the Display Name of the user account (e.g. "Martin Hatch"). Again this was identical for:
- Author
- AuthorOWSUSER
- DisplayAuthor
I basically want to have more control over how these values are output and formatted. In the case of date fields I want to reformat the date (which I'm sure I could work out using substring functions then and converting it to a date object, but that seems FAR too messy for me).
For the user field I really want the login name (or ideally their profile picture) but with just the display name there is very little I can do with it.
Any ideas? How on earth do these property mapping values get formatted?