ASP.NET MVC date filter for AngularJS

See Stack Overflow answer for more details: https://stackoverflow.com/questions/16104960/correctly-format-asp-net-mvc-dates-for-angularjs/25313287#25313287

by Jordan

HTML

<div ng-app="app">
  <div ng-controller="ctrl">
    {{ jsonDate | mvcDate: 'yyyy-MM-dd HH:mm:ss' }}
  </div>
</div>

JavaScript

var app = angular.module("app", []);

app.controller("ctrl", ['$scope', $scope => {
	$scope.jsonDate = "\/Date(1338364250000)\/";
}]);

app.filter('mvcDate', ['$filter', $filter =>
  (date, format, timezone) =>
    date && $filter('date')(date.slice(6, -2), format, timezone)
]);