fix: [NovelDeGlace] Correct Invalid Date(#1056)

This commit is contained in:
Elfing
2024-07-15 07:44:34 +02:00
committed by GitHub
parent 13a3c2dd02
commit e24d590728
2 changed files with 33 additions and 31 deletions
+16 -15
View File
@@ -11,7 +11,7 @@ class NovelDeGlacePlugin implements Plugin.PluginBase {
name = 'NovelDeGlace';
icon = 'src/fr/noveldeglace/icon.png';
site = 'https://noveldeglace.com/';
version = '1.0.2';
version = '1.0.3';
async getCheerio(url: string): Promise<CheerioAPI | undefined> {
const r = await fetchApi(url, {
@@ -24,25 +24,26 @@ class NovelDeGlacePlugin implements Plugin.PluginBase {
}
parseDate(date: string): string {
const monthMapping: Record<string, string> = {
janvier: 'January',
fevrier: 'February',
mars: 'March',
avril: 'April',
mai: 'May',
juin: 'June',
juillet: 'July',
aout: 'August',
septembre: 'September',
octobre: 'October',
novembre: 'November',
decembre: 'December',
const monthMapping: Record<string, number> = {
janvier: 1,
fevrier: 2,
mars: 3,
avril: 4,
mai: 5,
juin: 6,
juillet: 7,
aout: 8,
septembre: 9,
octobre: 10,
novembre: 11,
decembre: 12,
};
const [day, month, year] = date.split(' ');
return dayjs(
`${day} ${monthMapping[month.normalize('NFD').replace(/[\u0300-\u036f]/g, '')]} ${year}`,
'D MMMM YYYY',
).format('YYYY-MM-DD');
).format('DD MMMM YYYY');
}
parseNovels(
+17 -16
View File
@@ -11,7 +11,7 @@ class PhenixScansTradPlugin implements Plugin.PluginBase {
name = 'PhenixScans';
icon = 'src/fr/phenixscans/icon.png';
site = 'https://phenixscans.fr';
version = '1.0.0';
version = '1.0.1';
async getCheerio(url: string): Promise<CheerioAPI> {
const r = await fetchApi(url);
@@ -98,25 +98,26 @@ class PhenixScansTradPlugin implements Plugin.PluginBase {
}
parseDate(date: string): string {
const monthMapping: Record<string, string> = {
janvier: 'January',
fevrier: 'February',
mars: 'March',
avril: 'April',
mai: 'May',
juin: 'June',
juillet: 'July',
aout: 'August',
septembre: 'September',
octobre: 'October',
novembre: 'November',
decembre: 'December',
const monthMapping: Record<string, number> = {
janvier: 1,
fevrier: 2,
mars: 3,
avril: 4,
mai: 5,
juin: 6,
juillet: 7,
aout: 8,
septembre: 9,
octobre: 10,
novembre: 11,
decembre: 12,
};
const [month, day, year] = date.split(' ');
const [day, month, year] = date.split(' ');
return dayjs(
`${day} ${monthMapping[month.normalize('NFD').replace(/[\u0300-\u036f]/g, '')]} ${year}`,
'D MMMM YYYY',
).format('YYYY-MM-DD');
).format('DD MMMM YYYY');
}
getStatus(status: string) {