story: Fixed author/month not showing in menu, reordered menu.

This commit is contained in:
2018-10-02 21:41:22 +02:00
parent 3fbac994d2
commit fc5ce3705a
3 changed files with 13 additions and 16 deletions
+2 -2
View File
@@ -1,3 +1,4 @@
const moment = require("moment")
const express = require("express")
const router = express.Router()
@@ -16,11 +17,10 @@ router.get("/:yearmonth(\-{0,1}[0-9]{4}\-[0-9]{1,2})", common, async(req, res) =
// Month is zero-based, while input is one-based.
const fromDate = new Date(Date.UTC(year, month - 1, 1))
const toDate = new Date(Date.UTC(year, month, 1))
const monthStr = `${fromDate}-${month > 9 ? month : '0' + month}`
res.markoAsync(listTemplate, {
stories: storyApi.list({earliestFictionalDate: fromDate, latestFictionalDate: toDate}),
menuMonth: monthStr,
menuMonth: {url: moment.utc(fromDate).format("YYYY-MM"), text: moment.utc(fromDate).format("MMMM YYYY")},
selected: {special: "month"},
})
} catch(err) {