Bug 1383463 - Use mozIntl for cookies and page info. r=zibi, a=jcristau
authorJorg K <jorgk@jorgk.com>
Sat, 22 Jul 2017 23:18:00 -0400
changeset 414443 650bd331efd05fc5f26dae3e1d0b6e1ec4d3008a
parent 414442 3b36f2863e5c6d6896d9c35f2465531ee19c4a79
child 414444 78829e0f0362bcfdcceb7cef5ba163d16e2e643e
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszibi, jcristau
bugs1383463
milestone55.0
Bug 1383463 - Use mozIntl for cookies and page info. r=zibi, a=jcristau
browser/base/content/pageinfo/pageInfo.js
browser/components/preferences/cookies.js
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -1019,19 +1019,20 @@ function formatNumber(number) {
   return (+number).toLocaleString();  // coerce number to a numeric value before calling toLocaleString()
 }
 
 function formatDate(datestr, unknown) {
   var date = new Date(datestr);
   if (!date.valueOf())
     return unknown;
 
-  const dtOptions = { year: "numeric", month: "long", day: "numeric",
-                      hour: "numeric", minute: "numeric", second: "numeric" };
-  return date.toLocaleString(undefined, dtOptions);
+  const dateTimeFormatter = Services.intl.createDateTimeFormat(undefined, {
+    dateStyle: "long", timeStyle: "long"
+  });
+  return dateTimeFormatter.format(date);
 }
 
 function doCopy() {
   if (!gClipboardHelper)
     return;
 
   var elem = document.commandDispatcher.focusedElement;
 
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -492,19 +492,20 @@ var gCookiesWindow = {
         break;
     }
     this._view._rowCount = hostCount.value;
   },
 
   formatExpiresString(aExpires) {
     if (aExpires) {
       var date = new Date(1000 * aExpires);
-      const dtOptions = { year: "numeric", month: "long", day: "numeric",
-                          hour: "numeric", minute: "numeric", second: "numeric" };
-      return date.toLocaleString(undefined, dtOptions);
+      const dateTimeFormatter = Services.intl.createDateTimeFormat(undefined, {
+        dateStyle: "long", timeStyle: "long"
+      });
+      return dateTimeFormatter.format(date);
     }
     return this._bundle.getString("expireAtEndOfSession");
   },
 
   _getUserContextString(aUserContextId) {
     if (parseInt(aUserContextId) == 0) {
       return this._bundle.getString("defaultUserContextLabel");
     }