\ No newline at end of file
+
diff --git a/src/app/templates/story/detail.html b/src/app/templates/story/detail.html
index 4819949b..80fefd77 100644
--- a/src/app/templates/story/detail.html
+++ b/src/app/templates/story/detail.html
@@ -61,12 +61,9 @@
Last updated:
-
- {{story.updated_at | date: 'longDate'}}
-
-
- {{story.created_at | date: 'longDate'}}
-
+
+
+
Never
diff --git a/src/app/templates/util/time_moment.html b/src/app/templates/util/time_moment.html
new file mode 100644
index 00000000..219b5737
--- /dev/null
+++ b/src/app/templates/util/time_moment.html
@@ -0,0 +1,3 @@
+
+
+{{eventdate | date:'yyyy-MM-dd HH:mm:ss Z'}}
diff --git a/src/app/util/directive/time_moment.js b/src/app/util/directive/time_moment.js
new file mode 100644
index 00000000..fbe756a7
--- /dev/null
+++ b/src/app/util/directive/time_moment.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * A story status label that automatically selects color and text based on
+ * the bound-in story.
+ */
+angular.module('sb.util').directive('timeMoment',
+ function (DateUtil) {
+ 'use strict';
+
+ return {
+ restrict: 'A',
+ templateUrl: 'app/templates/util/time_moment.html',
+ scope: {
+ eventdate: '='
+ },
+ controller: function ($scope) {
+
+ /**
+ * Helper method to update the needs_timeago propery
+ */
+ function updateTimeAgo() {
+ $scope.needsTimeAgo =
+ DateUtil.needsTimeAgo($scope.eventdate);
+ }
+
+ var unwatch = $scope.$watch(updateTimeAgo);
+ $scope.$on('$destroy', unwatch);
+
+ updateTimeAgo();
+ }
+ };
+ }
+);
diff --git a/src/app/util/helpers/date_util.js b/src/app/util/helpers/date_util.js
new file mode 100644
index 00000000..eefaa640
--- /dev/null
+++ b/src/app/util/helpers/date_util.js
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * A collection of date utilities.
+ *
+ * @author Yolanda Robla
+ */
+angular.module('sb.util').factory('DateUtil',
+ function () {
+ 'use strict';
+
+ return {
+
+ /**
+ * Helper to check if a date needs to be formatted using
+ * TimeAgo plugion, or displaying UTC date
+ *
+ * @param date The date to be checked.
+ * @returns {boolean} True if time ago needs to be used.
+ */
+ needsTimeAgo: function (targetDate) {
+ if (targetDate)
+ {
+ var currentDate = new Date().getTime();
+ var daydiff = (currentDate - Date.parse(targetDate))/
+ (1000*60*60*24);
+ return (daydiff < 7);
+ }
+ else
+ {
+ return true;
+ }
+ }
+ };
+ }
+);
diff --git a/src/app/util/module.js b/src/app/util/module.js
index 40abfb9e..73465152 100644
--- a/src/app/util/module.js
+++ b/src/app/util/module.js
@@ -24,4 +24,4 @@ angular.module('sb.util', ['ui.router', 'LocalStorageModule'])
angular.element.prototype.show = function () {
this.removeClass('ng-hide');
};
- });
\ No newline at end of file
+ });
diff --git a/src/index.html b/src/index.html
index 8a461235..b7e93122 100644
--- a/src/index.html
+++ b/src/index.html
@@ -35,6 +35,8 @@
+
+
- {{event.created_at | date: 'medium'}} - {{ author.full_name }} has created this story. + + {{ author.full_name }} has created this story.