aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-09-13 10:44:16 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-09-13 11:58:11 +0200
commitae8c438f8d48be4d98bbd703a6784d250c73f524 (patch)
treeeb521804f614487ae687b50197b9d37439e6fc3d /server
parentbf50bf44a8f43ddc5d3c1de84ec152d74195284e (diff)
downloadsonarqube-ae8c438f8d48be4d98bbd703a6784d250c73f524.tar.gz
sonarqube-ae8c438f8d48be4d98bbd703a6784d250c73f524.zip
SONAR-9803 Prevent crashes when the date is undefined
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-list-item.hbs8
-rw-r--r--server/sonar-web/src/main/js/helpers/handlebars/d.js3
-rw-r--r--server/sonar-web/src/main/js/helpers/handlebars/dt.js3
3 files changed, 12 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-list-item.hbs b/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-list-item.hbs
index 9567fcfdfcf..7e26438880c 100644
--- a/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-list-item.hbs
+++ b/server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-list-item.hbs
@@ -19,10 +19,14 @@
</td>
<td class="">
- {{#if updatedAt}}
+ {{#if updatedAt }}
Updated on <span class="js-custom-measure-created-at">{{d updatedAt}}</span>
{{else}}
- Created on <span class="js-custom-measure-created-at">{{d createdAt}}</span>
+ {{#if createdAt }}
+ Created on <span class="js-custom-measure-created-at">{{d createdAt}}</span>
+ {{else}}
+ Created
+ {{/if}}
{{/if}}
by <span class="js-custom-measure-user">{{user.name}}</span>
</td>
diff --git a/server/sonar-web/src/main/js/helpers/handlebars/d.js b/server/sonar-web/src/main/js/helpers/handlebars/d.js
index fc61cb21129..ab4bda61097 100644
--- a/server/sonar-web/src/main/js/helpers/handlebars/d.js
+++ b/server/sonar-web/src/main/js/helpers/handlebars/d.js
@@ -21,6 +21,9 @@ const { parseDate } = require('../../helpers/dates');
const { DEFAULT_LANGUAGE } = require('../../helpers/l10n');
module.exports = function(date) {
+ if (!date) {
+ return '';
+ }
return new Intl.DateTimeFormat(localStorage.getItem('l10n.locale') || DEFAULT_LANGUAGE, {
year: 'numeric',
month: 'long',
diff --git a/server/sonar-web/src/main/js/helpers/handlebars/dt.js b/server/sonar-web/src/main/js/helpers/handlebars/dt.js
index 2334f217f88..e5f8e95f1c9 100644
--- a/server/sonar-web/src/main/js/helpers/handlebars/dt.js
+++ b/server/sonar-web/src/main/js/helpers/handlebars/dt.js
@@ -21,6 +21,9 @@ const { parseDate } = require('../../helpers/dates');
const { DEFAULT_LANGUAGE } = require('../../helpers/l10n');
module.exports = function(date) {
+ if (!date) {
+ return '';
+ }
return new Intl.DateTimeFormat(localStorage.getItem('l10n.locale') || DEFAULT_LANGUAGE, {
year: 'numeric',
month: 'long',