mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-21 22:57:31 +09:00
[Basilisk] Issue #31 - Part 1: Use nsIScriptableDateFormat in Page Info.
This commit is contained in:
parent
ec96755589
commit
b1d1a02c6c
1 changed files with 8 additions and 6 deletions
|
|
@ -1051,16 +1051,18 @@ function formatNumber(number)
|
||||||
|
|
||||||
function formatDate(datestr, unknown)
|
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);
|
var date = new Date(datestr);
|
||||||
if (!date.valueOf())
|
if (!date.valueOf())
|
||||||
return unknown;
|
return unknown;
|
||||||
|
|
||||||
const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
|
return dateService.FormatDateTime("", dateService.dateFormatLong,
|
||||||
.getService(Components.interfaces.nsIXULChromeRegistry)
|
dateService.timeFormatSeconds,
|
||||||
.getSelectedLocale("global", true);
|
date.getFullYear(), date.getMonth()+1, date.getDate(),
|
||||||
const dtOptions = { year: 'numeric', month: 'long', day: 'numeric',
|
date.getHours(), date.getMinutes(), date.getSeconds());
|
||||||
hour: 'numeric', minute: 'numeric', second: 'numeric' };
|
|
||||||
return date.toLocaleString(locale, dtOptions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doCopy()
|
function doCopy()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue