I understand that current date and time is from new Date.getTime()
How can I implement it so that each new post by all users will be stamped with a date and time and saved together with the post content?
Is it var timestamp = new Date.getTime()
or $scope.timestamp = new Date.getTime()
?
How do I save the date in the array when form is submitted with ng-click=submitPost()?
I inserted the following to mark each entry with a date and time. Within the submit post controller:
$scope.post = {url: 'http://', title: '', timestamp: new Date()};
And in the html
{{post.timestamp}}
Update for timestamping comments to the entry:
$scope.addComment = function () {
var comment = {
text: $scope.commentText,
creator: $scope.user.profile.username,
creatorUID: $scope.user.uid,
timestamp: new Date().toUTCString() //I added it here but doesnt work
};
$scope.comments.$add(comment);
$scope.commentText = '';
};