|
@ -1,3 +1,4 @@ |
|
|
|
|
|
const moment = require("moment") |
|
|
const express = require("express") |
|
|
const express = require("express") |
|
|
const router = express.Router() |
|
|
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.
|
|
|
// Month is zero-based, while input is one-based.
|
|
|
const fromDate = new Date(Date.UTC(year, month - 1, 1)) |
|
|
const fromDate = new Date(Date.UTC(year, month - 1, 1)) |
|
|
const toDate = new Date(Date.UTC(year, month, 1)) |
|
|
const toDate = new Date(Date.UTC(year, month, 1)) |
|
|
const monthStr = `${fromDate}-${month > 9 ? month : '0' + month}` |
|
|
|
|
|
|
|
|
|
|
|
res.markoAsync(listTemplate, { |
|
|
res.markoAsync(listTemplate, { |
|
|
stories: storyApi.list({earliestFictionalDate: fromDate, latestFictionalDate: toDate}), |
|
|
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"}, |
|
|
selected: {special: "month"}, |
|
|
}) |
|
|
}) |
|
|
} catch(err) { |
|
|
} catch(err) { |
|
|