Reputation: 11257
I have a JSON object I am trying to convert to a different date format in an underscore template. Is there a JavaScript function I can call on it? Or do I have to change it on the rails side first before it is converted to a JSON object?
Here is the underscore code in an underscore Template.
<p class='my-well media-body'><%%- comment %><p><p><%%-created_at%></p>
Is there a function I can call on the "created_at" to allow me to change the default value (created by the datetime in sql) 2013-12-09T05:28:16.495Z I would like the time in hours/minutes and the date in mm/dd/yy
I haven't been able to find a strftime type function in JavaScript, but I know there are some in Ruby. Do I have to change the format before the object is passed in as a JSON object?
My current project is build in a Rails backend and Backbone FrontEnd.
Upvotes: 1
Views: 2940