mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +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)
|
||||
{
|
||||
// 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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue