mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
[Basilisk] Issue #31 - Part 4: Use nsIScriptableDateFormat in cookie preferences.
This commit is contained in:
parent
443bc25ce0
commit
76fca5f990
1 changed files with 10 additions and 6 deletions
|
|
@ -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");
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue