diff --git a/browser/components/preferences/in-content/tests/browser_advanced_update.js b/browser/components/preferences/in-content/tests/browser_advanced_update.js index 1dc3a32548b1..e9d0e86521e2 100644 --- a/browser/components/preferences/in-content/tests/browser_advanced_update.js +++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js @@ -8,8 +8,6 @@ const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Com Cu.import('resource://gre/modules/XPCOMUtils.jsm'); const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator); -const dateFormat = Cc["@mozilla.org/intl/scriptabledateformat;1"] - .getService(Components.interfaces.nsIScriptableDateFormat); const mockUpdateManager = { contractId: "@mozilla.org/updates/update-manager;1", @@ -87,15 +85,12 @@ function resetPreferences() { function formatInstallDate(sec) { var date = new Date(sec); - return dateFormat.FormatDateTime("", - dateFormat.dateFormatLong, - dateFormat.timeFormatSeconds, - date.getFullYear(), - date.getMonth() + 1, - date.getDate(), - date.getHours(), - date.getMinutes(), - date.getSeconds()); + const locale = Cc["@mozilla.org/chrome/chrome-registry;1"] + .getService(Ci.nsIXULChromeRegistry) + .getSelectedLocale("global", true); + const dtOptions = { year: 'numeric', month: 'long', day: 'numeric', + hour: 'numeric', minute: 'numeric', second: 'numeric' }; + return date.toLocaleString(locale, dtOptions); } registerCleanupFunction(resetPreferences); diff --git a/toolkit/mozapps/update/content/history.js b/toolkit/mozapps/update/content/history.js index 624fd8a869dd..32a098de5322 100644 --- a/toolkit/mozapps/update/content/history.js +++ b/toolkit/mozapps/update/content/history.js @@ -58,18 +58,13 @@ var gUpdateHistory = { * @returns A human readable date string */ _formatDate: function(seconds) { - var sdf = - Components.classes["@mozilla.org/intl/scriptabledateformat;1"]. - getService(Components.interfaces.nsIScriptableDateFormat); var date = new Date(seconds); - return sdf.FormatDateTime("", sdf.dateFormatLong, - sdf.timeFormatSeconds, - date.getFullYear(), - date.getMonth() + 1, - date.getDate(), - date.getHours(), - date.getMinutes(), - date.getSeconds()); + const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"] + .getService(Components.interfaces.nsIXULChromeRegistry) + .getSelectedLocale("global", true); + const dtOptions = { year: 'numeric', month: 'long', day: 'numeric', + hour: 'numeric', minute: 'numeric', second: 'numeric' }; + return date.toLocaleString(locale, dtOptions); } };