rsshub
Version:
Make RSS Great Again!
19 lines (18 loc) • 819 B
JavaScript
import { t as config } from "./config-BfTrYkQS.mjs";
import { t as parseDateInTimezone } from "./parse-date-in-timezone-CdRNgnZr.mjs";
//#region lib/routes/smzdm/utils.ts
const parseSearchDate = (value, now = /* @__PURE__ */ new Date()) => {
const today = new Date(now.getTime() + 288e5).toISOString().slice(0, 10);
if (/^\d{2}:\d{2}$/.test(value)) return parseDateInTimezone(`${today}T${value}`, 8);
if (/^\d{2}-\d{2} \d{2}:\d{2}$/.test(value)) {
const year = Number(today.slice(0, 4)) - Number(value.slice(0, 5) > today.slice(5));
return parseDateInTimezone(`${year}-${value}`, 8);
}
};
const getHeaders = () => ({
accept: "application/json, text/javascript, */*; q=0.01",
cookie: config.smzdm.cookie,
"x-requested-with": "XMLHttpRequest"
});
//#endregion
export { parseSearchDate as n, getHeaders as t };