diff options
author | Moonchild <moonchild@palemoon.org> | 2020-12-04 18:13:56 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-12-04 18:13:56 +0000 |
commit | 01c28470c9e92275f86b22bbbe3a2d570059a38d (patch) | |
tree | 6519856a7c7b08803900f56efd3138227332c934 | |
parent | 5f972538cfdae60e03448cf4ca0ac28231ef1f03 (diff) | |
download | basilisk-01c28470c9e92275f86b22bbbe3a2d570059a38d.tar.gz |
Issue #31 - Part 4: Use nsIScriptableDateFormat in cookie preferences.
-rw-r--r-- | basilisk/components/preferences/cookies.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/basilisk/components/preferences/cookies.js b/basilisk/components/preferences/cookies.js index d44e9ee..b63072b 100644 --- a/basilisk/components/preferences/cookies.js +++ b/basilisk/components/preferences/cookies.js @@ -12,6 +12,8 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); var gCookiesWindow = { _cm : Components.classes["@mozilla.org/cookiemanager;1"] .getService(Components.interfaces.nsICookieManager), + _ds : Components.classes["@mozilla.org/intl/scriptabledateformat;1"] + .getService(Components.interfaces.nsIScriptableDateFormat), _hosts : {}, _hostOrder : [], _tree : null, @@ -490,12 +492,14 @@ var gCookiesWindow = { formatExpiresString: function (aExpires) { if (aExpires) { var date = new Date(1000 * aExpires); - 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); + return this._ds.FormatDateTime("", this._ds.dateFormatLong, + this._ds.timeFormatSeconds, + date.getFullYear(), + date.getMonth() + 1, + date.getDate(), + date.getHours(), + date.getMinutes(), + date.getSeconds()); } return this._bundle.getString("expireAtEndOfSession"); }, |