Created
March 4, 2014 16:15
-
-
Save killercup/9349548 to your computer and use it in GitHub Desktop.
Mongodb ObjectId Filter for Angular
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
angular.module('rm.MongoDB', []) | |
/** | |
* @method Object ID to Date | |
* @param {String} objectID The Object ID as String | |
* @return {Date} Creation Date of ObjectId | |
*/ | |
.filter("objectIDtoDate", function () { | |
return function (objectID) { | |
return new Date(parseInt((""+objectID).substr(0,8), 16)*1000); | |
}; | |
}) | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment