Bug 1442886 - Replace Services.intl.createDateTimeFormat with Services.intl.DateTimeFormat in SeaMonkey. r=frg
authorBill Gianopoulos <wgianopoulos@gmail.com>
Tue, 27 Feb 2018 10:44:40 -0500
changeset 31201 b8857d30de31c633f98e92d3401bc65172235720
parent 31200 52cdb91d97684c8dc7198fc14e20364830bad421
child 31202 248a595bf6bcd2c1befa53a72a0fb6321ec91bea
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersfrg
bugs1442886, 1428172
Bug 1442886 - Replace Services.intl.createDateTimeFormat with Services.intl.DateTimeFormat in SeaMonkey. r=frg Port Bug 1428172 [Align mozIntl with Intl when working with constructors].
suite/browser/pageinfo/pageInfo.js
suite/common/console/consoleBindings.xml
suite/common/dataman/dataman.js
suite/common/downloads/treeView.js
suite/common/permissions/cookieViewer.js
suite/common/places/tests/chrome/test_treeview_date.xul
suite/feeds/src/FeedWriter.js
suite/mailnews/addrbook/abCardViewOverlay.js
--- a/suite/browser/pageinfo/pageInfo.js
+++ b/suite/browser/pageinfo/pageInfo.js
@@ -1306,17 +1306,17 @@ function formatNumber(number)
 }
 
 function formatDate(datestr, unknown)
 {
   var date = new Date(datestr);
   if (!date.valueOf())
     return unknown;
 
-  const dateTimeFormatter = Services.intl.createDateTimeFormat(undefined, {
+  const dateTimeFormatter = new Services.intl.DateTimeFormat(undefined, {
                             dateStyle: "full", timeStyle: "long"});
   return dateTimeFormatter.format(date);
 }
 
 function getSelectedItems(linksMode)
 {
   // linksMode is a boolean that is used to determine
   // whether the getSelectedItems() function needs to
--- a/suite/common/console/consoleBindings.xml
+++ b/suite/common/console/consoleBindings.xml
@@ -272,17 +272,17 @@
           Services.console.logStringMessage(null);
           Services.console.reset();
         ]]></body>
       </method>
 
       <method name="properFormatTime">
         <parameter name="aTime"/>
         <body><![CDATA[
-          const dateServ = Services.intl.createDateTimeFormat(undefined, {
+          const dateServ = new Services.intl.DateTimeFormat(undefined, {
             dateStyle: "short", timeStyle: "long"
           });
           return dateServ.format(aTime);
         ]]></body>
       </method>
 
       <method name="copySelectedItem">
         <body><![CDATA[
--- a/suite/common/dataman/dataman.js
+++ b/suite/common/dataman/dataman.js
@@ -980,17 +980,17 @@ var gCookies = {
     if (aExpires) {
       let date = new Date(1000 * aExpires);
 
       // If a server manages to set a really long-lived cookie, the dateservice
       // can't cope with it properly, so we'll just return a blank string.
       // See bug 238045 for details.
       let expiry = "";
       try {
-        const dateTimeFormatter = Services.intl.createDateTimeFormat(undefined, {
+        const dateTimeFormatter = new Services.intl.DateTimeFormat(undefined, {
                                   dateStyle: "full", timeStyle: "long" });
         expiry = dateTimeFormatter.format(date);
       }
       catch (e) {}
       return expiry;
     }
     return gDataman.bundle.getString("cookies.expireAtEndOfSession");
   },
@@ -2857,17 +2857,17 @@ var gFormdata = {
     if (aTimestamp) {
       let date = new Date(aTimestamp / 1000);
 
       // If a date has an extreme value, the dateservice can't cope with it
       // properly, so we'll just return a blank string.
       // See bug 238045 for details.
       let dtString = "";
       try {
-        const dateTimeFormatter = Services.intl.createDateTimeFormat(undefined, {
+        const dateTimeFormatter = new Services.intl.DateTimeFormat(undefined, {
                                   dateStyle: "full", timeStyle: "long" });
         dtString = dateTimeFormatter.format(date);
       }
       catch (e) {}
       return dtString;
     }
     return "";
   },
--- a/suite/common/downloads/treeView.js
+++ b/suite/common/downloads/treeView.js
@@ -528,23 +528,23 @@ DownloadTreeView.prototype = {
   },
 
   // We use a different formatter for times within the current day,
   // so we cache both a "today" formatter and a general date formatter.
   __todayFormatter: null,
   get _todayFormatter() {
     if (!this.__todayFormatter) {
       const dtOptions = { timeStyle: "short" };
-      this.__todayFormatter = Services.intl.createDateTimeFormat(undefined, dtOptions);
+      this.__todayFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions);
     }
     return this.__todayFormatter;
   },
 
   __dateFormatter: null,
   get _dateFormatter() {
     if (!this.__dateFormatter) {
       const dtOptions = { dateStyle: "short", timeStyle: "short" };
-      this.__dateFormatter = Services.intl.createDateTimeFormat(undefined, dtOptions);
+      this.__dateFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions);
     }
     return this.__dateFormatter;
   },
 
 };
--- a/suite/common/permissions/cookieViewer.js
+++ b/suite/common/permissions/cookieViewer.js
@@ -165,17 +165,17 @@ function GetExpiresString(expires) {
   if (expires) {
     var date = new Date(1000*expires);
 
     // if a server manages to set a really long-lived cookie, the dateservice
     // can't cope with it properly, so we'll just return a blank string
     // see bug 238045 for details
     var expiry = "";
     try {
-      const dateTimeFormatter = Services.intl.createDateTimeFormat(undefined, {
+      const dateTimeFormatter = new Services.intl.DateTimeFormat(undefined, {
                                 dateStyle: "full", timeStyle: "long" });
       expiry = dateTimeFormatter.format(date);
     } catch(ex) {
       // do nothing
     }
     return expiry;
   }
   return cookieBundle.getString("expireAtEndOfSession");
--- a/suite/common/places/tests/chrome/test_treeview_date.xul
+++ b/suite/common/places/tests/chrome/test_treeview_date.xul
@@ -126,17 +126,17 @@
                 if (node.uri == "http://at.midnight.com/" ||
                     node.uri == "http://after.midnight.com/") {
                   dtOptions.dateStyle = undefined;
                 } else if (node.uri != "http://before.midnight.com/") {
                   // Avoid to test spurious uris, due to how the test works
                   // a redirecting uri could be put in the tree while we test.
                   break;
                 }
-                let timeStr = Services.intl.createDateTimeFormat(undefined, dtOptions).format(timeObj);
+                let timeStr = new Services.intl.DateTimeFormat(undefined, dtOptions).format(timeObj);
                 is(text, timeStr, "Date format is correct");
                 break;
               case "visitCount":
                 is(text, 1, "Visit count is correct");
                 break;
             }
           }
         }
--- a/suite/feeds/src/FeedWriter.js
+++ b/suite/feeds/src/FeedWriter.js
@@ -276,17 +276,17 @@ FeedWriter.prototype = {
 
     return this._dateFormatter.format(dateObj);
   },
 
   __dateFormatter: null,
   get _dateFormatter() {
     if (!this.__dateFormatter) {
       const dtOptions = { timeStyle: "short", dateStyle: "long" };
-      this.__dateFormatter = Services.intl.createDateTimeFormat(undefined, dtOptions);
+      this.__dateFormatter = new Services.intl.DateTimeFormat(undefined, dtOptions);
     }
     return this.__dateFormatter;
   },
 
   /**
    * Returns the feed type.
    */
   __feedType: null,
--- a/suite/mailnews/addrbook/abCardViewOverlay.js
+++ b/suite/mailnews/addrbook/abCardViewOverlay.js
@@ -246,23 +246,23 @@ function DisplayCardViewPane(realCard)
     if (day > 0 && day < 32 && month > 0 && month < 13) {
       var date;
       var formatter;
       if (year) {
         // use UTC-based calculations to avoid off-by-one day
         // due to time zone/dst discontinuity
         date = new Date(Date.UTC(year, month - 1, day));
         date.setUTCFullYear(year); // to handle two-digit years properly
-        formatter = Services.intl.createDateTimeFormat(undefined,
+        formatter = new Services.intl.DateTimeFormat(undefined,
                        { dateStyle: "long", timeZone: "UTC" });
       }
       // if the year doesn't exist, display Month DD (ex. January 1)
       else {
         date = new Date(Date.UTC(saneBirthYear(year), month - 1, day));
-        formatter = Services.intl.createDateTimeFormat(undefined,
+        formatter = new Services.intl.DateTimeFormat(undefined,
                       { month: "long", day: "numeric", timeZone: "UTC" });
       }
       dateStr = formatter.format(date);
     }
     else if (year)
       dateStr = year;
     visible = cvSetNodeWithLabel(data.cvBirthday, zBirthday, dateStr);