Skip to content

Instantly share code, notes, and snippets.

@edinella
Created July 9, 2013 20:06
Show Gist options
  • Save edinella/5960784 to your computer and use it in GitHub Desktop.
Save edinella/5960784 to your computer and use it in GitHub Desktop.
Aplica o filtro 'date' do angular mesmo que a entrada seja uma string
/**
* {{ 'October 13, 1975 11:13:00' | toDate }}
* {{ 'October 13, 1975 11:13:00' | toDate:'yyyy-MM-ddTHH:mm:ss.SSSZ' }}
*/
.filter('toDate', function ($filter) {
return function(input, format) {
format = format || 'medium';
return $filter('date')(new Date(input), format);
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment