title: Moment JS Parse Whole JSON Array and Format Multiple Date Instances
body: <p>I get an array of JSON objects back from my MVC controller and the objects have a couple of date fields I was to parse and format.</p>
  
  <p>I've replaced the default MVC JSON serialiser with the excellent Newtonsoft.Json library so my dates are already fairly nicely formatted and come back like this:</p>
  
  <pre><code>"SystemDate": "2013-05-06T17:19:40.443",
  "LocalDate": "2013-05-06T18:19:40",
  </code></pre>
  
  <p>I'm using Moment.js on the client side for my date handling and I have been looking for a neat solution to further format these dates for display in the UI.</p>
  
  <p>I was about to start writing a custom function that would take a JSON array of objects with dates to format and a date pattern and an array of field names to format.</p>
  
  <p>The function signature would look something like:</p>
  
  <pre><code>function formatDates(dataArray, pattern, fields) { /code/ };
  </code></pre>
  
  <p>dataArray would be something like:</p>
  
  <pre><code>[{"name": Jammer, 
    "SystemDate": "2013-05-06T17:19:40.443", 
    "LocalDate": "2013-05-06T18:19:40"
   }, 
   {another object}
   {another object} 
   {another object}
  ]
  </code></pre>
  
  <p>pattern would be something like:</p>
  
  <pre><code>"dddd, MMMM Do YYYY, h:mm:ss a"
  </code></pre>
  
  <p>The list of fields would be (using the above example object):</p>
  
  <pre><code>[{"SystemDate"}, {"LocalDate"}]
  </code></pre>
  
  <p>I've only just started using Moment.js so I'm not particularly familiar with it's own API but from <a href="http://momentjs.com/docs/" rel="nofollow">looking at the docs</a> there isn't anything suggesting this kind of functionality already existing in it's codebase.</p>
  
  <p>Before I go off an implement this I was wondering if there was something already in Moment.js that would handle this for me?  Or any pointers on how to best implement this functionality?</p>