diff --git a/src-ui/src/app/components/manage/settings/settings.component.html b/src-ui/src/app/components/manage/settings/settings.component.html
index aa7ea05d3..3674bbcb9 100644
--- a/src-ui/src/app/components/manage/settings/settings.component.html
+++ b/src-ui/src/app/components/manage/settings/settings.component.html
@@ -34,7 +34,7 @@
diff --git a/src-ui/src/app/components/manage/settings/settings.component.ts b/src-ui/src/app/components/manage/settings/settings.component.ts
index 47c7b8d7b..15cfb8a19 100644
--- a/src-ui/src/app/components/manage/settings/settings.component.ts
+++ b/src-ui/src/app/components/manage/settings/settings.component.ts
@@ -35,7 +35,7 @@ export class SettingsComponent implements OnInit {
savedViews: PaperlessSavedView[]
get computedDateLocale(): string {
- return this.settingsForm.value.dateLocale || this.settingsForm.value.displayLanguage
+ return this.settingsForm.value.dateLocale || this.settingsForm.value.displayLanguage || this.currentLocale
}
constructor(
@@ -92,7 +92,10 @@ export class SettingsComponent implements OnInit {
}
get dateLocaleOptions(): LanguageOption[] {
- return [{code: "", name: $localize`Use date format of display language`}].concat(this.settings.getLanguageOptions())
+ return [
+ {code: "", name: $localize`Use date format of display language`},
+ {code: "iso-8601", name: $localize`ISO 8601`}
+ ].concat(this.settings.getLanguageOptions())
}
get today() {
diff --git a/src-ui/src/app/pipes/custom-date.pipe.ts b/src-ui/src/app/pipes/custom-date.pipe.ts
index 19989fbdd..cf5a931cb 100644
--- a/src-ui/src/app/pipes/custom-date.pipe.ts
+++ b/src-ui/src/app/pipes/custom-date.pipe.ts
@@ -2,18 +2,29 @@ import { DatePipe } from '@angular/common';
import { Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core';
import { SettingsService, SETTINGS_KEYS } from '../services/settings.service';
+const FORMAT_TO_ISO_FORMAT = {
+ "longDate": "y-MM-dd",
+ "mediumDate": "yy-MM-dd",
+ "shortDate": "yy-MM-dd"
+}
+
@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)
-
+ super(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)
+ let l = locale || this.settings.get(SETTINGS_KEYS.DATE_LOCALE)
+ let f = format || this.settings.get(SETTINGS_KEYS.DATE_FORMAT)
+ if (l == "iso-8601") {
+ return super.transform(value, FORMAT_TO_ISO_FORMAT[f], timezone)
+ } else {
+ return super.transform(value, format || this.settings.get(SETTINGS_KEYS.DATE_FORMAT), timezone, locale)
+ }
}
}