Skip to content

Instantly share code, notes, and snippets.

@andrewdelprete
Created April 23, 2014 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewdelprete/11235663 to your computer and use it in GitHub Desktop.
Save andrewdelprete/11235663 to your computer and use it in GitHub Desktop.
AngularJS - dateLocalize Filter localizes UTC time
//
// Example: {{ request.updated_at | dateLocalize | date:'short' }}
angular.module('MyApp', [])
.filter('dateLocalize', function () {
return function (utcDate) {
var dt = new Date(utcDate + 'Z').getTime();
return dt;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment