Bug 1383463 - Use mozIntl for cookies and page info. r=zibi
authorJorg K <jorgk@jorgk.com>
Sat, 22 Jul 2017 23:18:00 -0400
changeset 419295 3d14ed20c13133113b428e3e2a8635ca616bc63d
parent 419294 d055c4a269c41792c09bceeae314084c7eba9bc0
child 419296 93aa802eeb9da6ef8b78d63d99b741506b0f7c0f
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszibi
bugs1383463
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383463 - Use mozIntl for cookies and page info. r=zibi
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");
     }