Index: lib/utils.js |
=================================================================== |
--- a/lib/utils.js |
+++ b/lib/utils.js |
@@ -247,21 +247,17 @@ let Utils = exports.Utils = |
* Formats a unix time according to user's locale. |
* @param {Integer} time unix time in milliseconds |
* @return {String} formatted date and time |
Wladimir Palant
2017/06/08 08:13:02
Yes, I am aware of this not being entirely correct
|
*/ |
formatTime: function(time) |
{ |
try |
{ |
- let date = new Date(time); |
- return Utils.dateFormatter.FormatDateTime("", Ci.nsIScriptableDateFormat.dateFormatShort, |
- Ci.nsIScriptableDateFormat.timeFormatNoSeconds, |
- date.getFullYear(), date.getMonth() + 1, date.getDate(), |
- date.getHours(), date.getMinutes(), date.getSeconds()); |
+ return Utils.dateFormatter.format(time); |
Wladimir Palant
2017/06/08 08:13:01
The MDN documentation doesn't define the parameter
|
} |
catch(e) |
{ |
// Make sure to return even on errors |
Cu.reportError(e); |
return ""; |
} |
}, |
@@ -555,20 +551,29 @@ XPCOMUtils.defineLazyServiceGetter(Utils |
XPCOMUtils.defineLazyServiceGetter(Utils, "netUtils", "@mozilla.org/network/util;1", "nsINetUtil"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "styleService", "@mozilla.org/content/style-sheet-service;1", "nsIStyleSheetService"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "prefService", "@mozilla.org/preferences-service;1", "nsIPrefService"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "versionComparator", "@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "windowMediator", "@mozilla.org/appshell/window-mediator;1", "nsIWindowMediator"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "windowWatcher", "@mozilla.org/embedcomp/window-watcher;1", "nsIWindowWatcher"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "chromeRegistry", "@mozilla.org/chrome/chrome-registry;1", "nsIXULChromeRegistry"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "systemPrincipal", "@mozilla.org/systemprincipal;1", "nsIPrincipal"); |
-XPCOMUtils.defineLazyServiceGetter(Utils, "dateFormatter", "@mozilla.org/intl/scriptabledateformat;1", "nsIScriptableDateFormat"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "httpProtocol", "@mozilla.org/network/protocol;1?name=http", "nsIHttpProtocolHandler"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "clipboard", "@mozilla.org/widget/clipboard;1", "nsIClipboard"); |
XPCOMUtils.defineLazyServiceGetter(Utils, "clipboardHelper", "@mozilla.org/widget/clipboardhelper;1", "nsIClipboardHelper"); |
+XPCOMUtils.defineLazyGetter(Utils, "dateFormatter", function() |
+{ |
+ return new Intl.DateTimeFormat(Utils.appLocale, { |
Wladimir Palant
2017/06/08 08:13:01
Originally, I meant to pass undefined as first par
Wladimir Palant
2017/06/08 08:49:02
After looking a bit more into this, the inconsiste
|
+ year: "numeric", |
+ month: "numeric", |
+ day: "numeric", |
+ hour: "numeric", |
+ minute: "numeric" |
+ }); |
+}); |
XPCOMUtils.defineLazyGetter(Utils, "crypto", function() |
{ |
try |
{ |
let ctypes = Cu.import("resource://gre/modules/ctypes.jsm", null).ctypes; |
let nsslib; |
try |