Created
March 25, 2015 20:44
-
-
Save wallace7souza/8c649bd90fe13ce904cb to your computer and use it in GitHub Desktop.
Angularjs dateTime format filter using moment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* @ngdoc filter | |
* @function | |
* @description | |
* # dateTimeFormat | |
* Filter in the engagedAcademicApp. | |
*/ | |
angular.module('myApp') | |
.filter('momentFormat', function () { | |
return function (dtOriginal,format2View,format2Read) { | |
if(format2Read===null || format2Read===undefined){ | |
format2Read='YYYY-MM-DD h:mm:ss'; | |
} | |
var x = moment(dtOriginal,format2Read); | |
return x.format(x.format(format2View)); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment