mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 00:17:32 +09:00
[Basilisk] Issue #31 - Part 3: Use nsIScriptableDateFormat in places library window.
This commit is contained in:
parent
ad9127aad4
commit
443bc25ce0
2 changed files with 27 additions and 35 deletions
|
|
@ -409,11 +409,8 @@ var PlacesOrganizer = {
|
|||
populateRestoreMenu: function() {
|
||||
let restorePopup = document.getElementById("fileRestorePopup");
|
||||
|
||||
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIXULChromeRegistry)
|
||||
.getSelectedLocale("global", true);
|
||||
const dtOptions = { year: 'numeric', month: 'long', day: 'numeric' };
|
||||
let dateFormatter = new Intl.DateTimeFormat(locale, dtOptions);
|
||||
let dateSvc = Cc["@mozilla.org/intl/scriptabledateformat;1"].
|
||||
getService(Ci.nsIScriptableDateFormat);
|
||||
|
||||
// Remove existing menu items. Last item is the restoreFromFile item.
|
||||
while (restorePopup.childNodes.length > 1)
|
||||
|
|
@ -445,7 +442,13 @@ var PlacesOrganizer = {
|
|||
let backupDate = PlacesBackups.getDateForFile(backupFiles[i]);
|
||||
let m = restorePopup.insertBefore(document.createElement("menuitem"),
|
||||
document.getElementById("restoreFromFile"));
|
||||
m.setAttribute("label", dateFormatter.format(backupDate) + sizeInfo);
|
||||
m.setAttribute("label",
|
||||
dateSvc.FormatDate("",
|
||||
Ci.nsIScriptableDateFormat.dateFormatLong,
|
||||
backupDate.getFullYear(),
|
||||
backupDate.getMonth() + 1,
|
||||
backupDate.getDate()) +
|
||||
sizeInfo);
|
||||
m.setAttribute("value", OS.Path.basename(backupFiles[i]));
|
||||
m.setAttribute("oncommand",
|
||||
"PlacesOrganizer.onRestoreMenuItemClick(this);");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue