mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
[Basilisk] Issue #31 - Part 2: Use nsIScriptableDateFormat in feeds.
This commit is contained in:
parent
b1d1a02c6c
commit
ad9127aad4
1 changed files with 5 additions and 14 deletions
|
|
@ -185,20 +185,11 @@ FeedWriter.prototype = {
|
|||
if (!dateObj.getTime())
|
||||
return false;
|
||||
|
||||
return this._dateFormatter.format(dateObj);
|
||||
},
|
||||
|
||||
__dateFormatter: null,
|
||||
get _dateFormatter() {
|
||||
if (!this.__dateFormatter) {
|
||||
const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIXULChromeRegistry)
|
||||
.getSelectedLocale("global", true);
|
||||
const dtOptions = { year: 'numeric', month: 'long', day: 'numeric',
|
||||
hour: 'numeric', minute: 'numeric' };
|
||||
this.__dateFormatter = new Intl.DateTimeFormat(locale, dtOptions);
|
||||
}
|
||||
return this.__dateFormatter;
|
||||
let dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"].
|
||||
getService(Ci.nsIScriptableDateFormat);
|
||||
return dateService.FormatDateTime("", dateService.dateFormatLong, dateService.timeFormatNoSeconds,
|
||||
dateObj.getFullYear(), dateObj.getMonth()+1, dateObj.getDate(),
|
||||
dateObj.getHours(), dateObj.getMinutes(), dateObj.getSeconds());
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue