Bug 1346812 - Use standard pad functions in aboutTelemetry.js draft
authorflyingrub
Mon, 13 Mar 2017 16:12:00 +0100
changeset 497775 ca1edefec340e7d46ab245b52758193959267417
parent 497654 7b19a63862252ffb89bfe1ba79724e76e20fb6f4
child 548980 e3d34a662d34df3aebb934a4149537a1f3e0c77e
push id48999
push userbmo:flyinggrub@gmail.com
push dateMon, 13 Mar 2017 20:54:03 +0000
bugs1346812
milestone55.0a1
Bug 1346812 - Use standard pad functions in aboutTelemetry.js MozReview-Commit-ID: 7S3tUVvoKsv
toolkit/content/aboutTelemetry.js
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -170,17 +170,17 @@ function removeAllChildNodes(node) {
     node.removeChild(node.lastChild);
   }
 }
 
 /**
  * Pad a number to two digits with leading "0".
  */
 function padToTwoDigits(n) {
-  return (n > 9) ? n : "0" + n;
+  return new String(n).padStart(2, "0");
 }
 
 /**
  * Return yesterdays date with the same time.
  */
 function yesterday(date) {
   let d = new Date(date);
   d.setDate(d.getDate() - 1);