Bug 1376167 - Avoid use of nsIScriptableDateFomat in Seamonkey XML files. r=frg
authorBill Gianopoulos <wgianopoulos@gmail.com>
Sun, 16 Jul 2017 07:09:46 -0400
changeset 28471 a73acae42ace1e85a82818ec51b9690712a0bf57
parent 28470 9cea2329de98ee52acdbfac1a2240d174ccaf280
child 28472 2e7e88db2d5d7fb1ae736bc7b7b4b12f8487273e
push id1986
push userclokep@gmail.com
push dateWed, 02 Aug 2017 14:43:31 +0000
treeherdercomm-beta@b51c9adf2c9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg
bugs1376167
Bug 1376167 - Avoid use of nsIScriptableDateFomat in Seamonkey XML files. r=frg
suite/common/console/consoleBindings.xml
--- a/suite/common/console/consoleBindings.xml
+++ b/suite/common/console/consoleBindings.xml
@@ -273,22 +273,20 @@
           Services.console.logStringMessage(null);
           Services.console.reset();
         ]]></body>
       </method>
 
       <method name="properFormatTime">
         <parameter name="aTime"/>
         <body><![CDATA[
-          const dateServ = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
-                                     .getService(Components.interfaces.nsIScriptableDateFormat);
-          let errorTime = new Date(aTime);
-          return dateServ.FormatDateTime("", dateServ.dateFormatShort, dateServ.timeFormatSeconds,
-              errorTime.getFullYear(), errorTime.getMonth() + 1, errorTime.getDate(),
-              errorTime.getHours(), errorTime.getMinutes(), errorTime.getSeconds());
+          const dateServ = Services.intl.createDateTimeFormat(undefined, {
+            dateStyle: "short", timeStyle: "short"
+          });
+          return dateServ.format(aTime);
         ]]></body>
       </method>
 
       <method name="copySelectedItem">
         <body><![CDATA[
           if (this.mSelectedItem) try {
             const clipURI = "@mozilla.org/widget/clipboardhelper;1";
             const clipI = Components.interfaces.nsIClipboardHelper;