date fix + master merge (#761)

* date fix
This commit is contained in:
NaddH1
2024-02-08 17:55:37 +03:00
committed by GitHub
parent db921e704f
commit 8e83c9067e
+31 -7
View File
@@ -100,15 +100,39 @@ class Genesis implements Plugin.PluginBase {
.text()
.trim();
if (!releaseDate) return;
chapter.push({
name: chapterName,
releaseTime: dayjs(releaseDate).toISOString(),
if (!releaseDate) return;
const months = [
"jan",
"feb",
"mar",
"apr",
"may",
"jun",
"jul",
"aug",
"sep",
"oct",
"nov",
"dec",
];
const rx = new RegExp(
`(${months.join("|")}).*? (\\d{2}).*?(\\d{4})`,
"i"
).exec(releaseDate);
if (!rx) return;
const year = +rx[3];
const month = months.indexOf(rx[1].toLowerCase());
const day = +rx[2];
if (month < 0) return;
chapter.push({
name: chapterName,
releaseTime: new Date(year, month, day).toISOString(),
url: chapterUrl,
});
url: chapterUrl,
});
});
novel.chapters = chapter.reverse();
return novel;