mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-16 21:55:37 -05:00
add configuration option for changing date display in paperless #325
This commit is contained in:
19
src-ui/src/app/pipes/custom-date.pipe.ts
Normal file
19
src-ui/src/app/pipes/custom-date.pipe.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core';
|
||||
import { SettingsService, SETTINGS_KEYS } from '../services/settings.service';
|
||||
|
||||
@Pipe({
|
||||
name: 'customDate'
|
||||
})
|
||||
export class CustomDatePipe extends DatePipe implements PipeTransform {
|
||||
|
||||
constructor(@Inject(LOCALE_ID) locale: string, private settings: SettingsService) {
|
||||
super(settings.get(SETTINGS_KEYS.DATE_LOCALE) || locale)
|
||||
|
||||
}
|
||||
|
||||
transform(value: any, format?: string, timezone?: string, locale?: string): string | null {
|
||||
return super.transform(value, format || this.settings.get(SETTINGS_KEYS.DATE_FORMAT), timezone, locale)
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user