diff options
author | Moonchild <moonchild@palemoon.org> | 2020-12-04 18:12:10 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-12-04 18:12:10 +0000 |
commit | 8a74eeb8ee67563d02ec6e3f74ddfc9ef8e65a14 (patch) | |
tree | 75e8f4165f5407f0eead331646d16c3fd54d771d | |
parent | c7a029f8429f2a0e348a4039876dca5afb7cbc75 (diff) | |
download | basilisk-8a74eeb8ee67563d02ec6e3f74ddfc9ef8e65a14.tar.gz |
Issue #31 - Part 2: Use nsIScriptableDateFormat in feeds.
-rw-r--r-- | basilisk/components/feeds/FeedWriter.js | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/basilisk/components/feeds/FeedWriter.js b/basilisk/components/feeds/FeedWriter.js index ceb2a7e..d208ee5 100644 --- a/basilisk/components/feeds/FeedWriter.js +++ b/basilisk/components/feeds/FeedWriter.js @@ -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()); }, /** |