Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
error7404 committed Jun 29, 2024
1 parent 1ac8cbf commit da0dbbb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/multisrc/madara/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class MadaraPlugin implements Plugin.PluginBase {
this.version = `1.0.${2 + versionIncrements}`;
this.options = metadata.options;
this.filters = metadata.filters;
const lang = metadata.options?.lang || 'en';
dayjs.locale(lang);
console.log(dayjs.locale());
}

translateDragontea(text: Cheerio<AnyNode>): Cheerio<AnyNode> {
Expand Down Expand Up @@ -361,11 +364,10 @@ class MadaraPlugin implements Plugin.PluginBase {
} else if (includesAny(date, ['year', 'año'])) {
dayJSDate = dayJSDate.subtract(timeAgoInt, 'year'); // go back N years
} else {
try {
if (dayjs(date).format('LL') !== 'Invalid Date') {
return dayjs(date).format('LL');
} catch (e) {
return date;
}
return date;
}

return dayJSDate.format('LL');
Expand Down

0 comments on commit da0dbbb

Please sign in to comment.