]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9803 Prevent crashes when the date is undefined
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 13 Sep 2017 08:44:16 +0000 (10:44 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 13 Sep 2017 11:51:11 +0000 (13:51 +0200)
server/sonar-web/src/main/js/apps/custom-measures/templates/custom-measures-list-item.hbs
server/sonar-web/src/main/js/helpers/handlebars/d.js
server/sonar-web/src/main/js/helpers/handlebars/dt.js

index 9567fcfdfcfb69d004531919e0342dd197c21d56..7e26438880c14ca296cffa8cc27026dc6b002a2b 100644 (file)
 </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>
index fc61cb21129e2d708381c6b513b540d59d608de8..ab4bda610971a0a26fe29e2875e42256d4c46f71 100644 (file)
@@ -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',
index 2334f217f8847e9218b049f85f96bc5e5af07aa7..e5f8e95f1c921a7f5ccd20a88b28aba523b0b605 100644 (file)
@@ -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',