This project is read-only.

change 'date' format in detail screen

Topics: General
Nov 30, 2012 at 1:21 PM

in a 'projection' I use a query where the 'Title' is defined as 'Link to original content item'.
The 'content item' carries a 'Date' field e.g 3/7/12.

When clicking the 'Title', in the detail screen, the 'date' field is shown as 3/7/12.
I would like to transform this date, in the detail screen, to show as "Thursday, July 3"

What is the Orchard-way to achieve this transform?
... I obviously have a blackout!

Thanks for your time and advise

Nov 30, 2012 at 5:14 PM

Create an alternate for the display template of the field.

Nov 30, 2012 at 7:36 PM

hmmm, thanks ed

Dec 1, 2012 at 6:47 AM

You pointed me to the obvious but now I get:

error: 'string.ToString(System.IFormatProvider)' has some invalid arguments

and I found following thread: ? is this still an open issue ?

thanks for your time, ed

I used:

@using Orchard.Utility.Extensions;

    string name = Model.ContentField.DisplayName;

class="date-time-field date-time-field-@name.HtmlClassify()"> class="name">@name.CamelFriendly(): class="value">@if (Model.Model.ShowDate) { <text>@Model.Model.Date.ToString("dddd,dd mmm yyyy")</text> } @if (Model.Model.ShowTime) { <text>@Model.Model.Time</text> }


Dec 1, 2012 at 6:54 AM

I don't remember the bug ever being filed, so probably still an issue, but maybe I missed it.

Dec 12, 2012 at 7:17 AM
Edited Dec 12, 2012 at 7:27 AM

haven't seen any movement! Will report a bug?


Dec 14, 2012 at 2:12 AM

Yes, please do.