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

@ -8,6 +8,7 @@ import { MediaType } from '../../utils/MediaType';
export class SteamAPI extends APIModel {
plugin: MediaDbPlugin;
typeMappings: Map<string, string>;
apiDateFormat: string = 'DD MMM, YYYY';
constructor(plugin: MediaDbPlugin) {
super();
@ -109,7 +110,7 @@ export class SteamAPI extends APIModel {
image: result.header_image ?? '',
released: !result.release_date?.comming_soon,
releaseDate: new Date(result.release_date?.date).toLocaleDateString() ?? 'unknown',
releaseDate: this.plugin.dateFormatter.format(result.release_date?.date, this.apiDateFormat) ?? 'unknown',
userData: {
played: false,