summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-12-04 18:11:46 +0000
committerMoonchild <moonchild@palemoon.org>2020-12-04 18:11:46 +0000
commitc7a029f8429f2a0e348a4039876dca5afb7cbc75 (patch)
treef2000a33ae088db4142e2462fe3d19414dd96e20
parent11839e24c82f2deb49c4e0d726be84bbccefcdee (diff)
downloadbasilisk-c7a029f8429f2a0e348a4039876dca5afb7cbc75.tar.gz
Issue #31 - Part 1: Use nsIScriptableDateFormat in Page Info.
-rw-r--r--basilisk/base/content/pageinfo/pageInfo.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/basilisk/base/content/pageinfo/pageInfo.js b/basilisk/base/content/pageinfo/pageInfo.js
index 7a6d0a0..98e567c 100644
--- a/basilisk/base/content/pageinfo/pageInfo.js
+++ b/basilisk/base/content/pageinfo/pageInfo.js
@@ -1051,16 +1051,18 @@ function formatNumber(number)
function formatDate(datestr, unknown)
{
+ // scriptable date formatter, for pretty printing dates
+ var dateService = Components.classes["@mozilla.org/intl/scriptabledateformat;1"]
+ .getService(Components.interfaces.nsIScriptableDateFormat);
+
var date = new Date(datestr);
if (!date.valueOf())
return unknown;
- 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 dateService.FormatDateTime("", dateService.dateFormatLong,
+ dateService.timeFormatSeconds,
+ date.getFullYear(), date.getMonth()+1, date.getDate(),
+ date.getHours(), date.getMinutes(), date.getSeconds());
}
function doCopy()