Arianule
Arianule

Reputation: 9053

Displaying date underscore template

I am using underscore template and want to display Date format.

importHistories = new List<object>();
importHistories.AddRange(context.Imports.Select(t =>
 new
  {
      DateCreated = t.DateCreated,
      ImportHistoryId = t.ImportHistoryId,

Underscore template

<% _.each(ImportHistories, function(history) { %>
 <tr>
     <td><%=history.ImportHistoryId %></td>
     <td><%=history.DateCreated %></td>
 </tr>
<% });%>

as it is the date is displayed as such

/Date(1386682653060)/

How could I apply formtting to the date in the template ?

Upvotes: 1

Views: 182

Answers (1)

Arianule
Arianule

Reputation: 9053

got it.

Made the following change

importHistories.AddRange(context.Imports.ToList().Select(t =>
new
{
     DateCreated = t.DateCreated.ToString("MMMM dd, yyyy"),
     ImportHistoryId = t.ImportHistoryId,

Upvotes: 1

Related Questions