add feature to customize date formatting

This commit is contained in:
SvenPf 2023-07-24 01:12:38 +02:00
parent 2d2e380673
commit 0514ce5eb8
8 changed files with 110 additions and 9 deletions

View file

@ -6,6 +6,7 @@ import { MediaType } from '../../utils/MediaType';
export class WikipediaAPI extends APIModel {
plugin: MediaDbPlugin;
apiDateFormat: string = 'YYYY-MM-DDTHH:mm:ssZ'; // ISO
constructor(plugin: MediaDbPlugin) {
super();
@ -72,7 +73,7 @@ export class WikipediaAPI extends APIModel {
id: result.pageid,
wikiUrl: result.fullurl,
lastUpdated: new Date(result.touched).toLocaleDateString() ?? 'unknown',
lastUpdated: this.plugin.dateFormatter.format(result.touched, this.apiDateFormat),
length: result.length,
userData: {},