Allow "live" changing of date format

This commit is contained in:
Michael Shamoon 2021-01-16 20:49:12 -08:00
parent b9a2f82ce0
commit 31b74515b6
2 changed files with 7 additions and 3 deletions

View File

@ -48,15 +48,15 @@
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" id="dateFormatShort" name="dateFormat" class="custom-control-input" formControlName="dateFormat" value="shortDate"> <input type="radio" id="dateFormatShort" name="dateFormat" class="custom-control-input" formControlName="dateFormat" value="shortDate">
<label class="custom-control-label" for="dateFormatShort" i18n>Short: {{today | customDate:'shortDate'}}</label> <label class="custom-control-label" for="dateFormatShort" i18n>Short: {{today | customDate:'shortDate':null:comptuedDateLocale}}</label>
</div> </div>
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" id="dateFormatMedium" name="dateFormat" class="custom-control-input" formControlName="dateFormat" value="mediumDate"> <input type="radio" id="dateFormatMedium" name="dateFormat" class="custom-control-input" formControlName="dateFormat" value="mediumDate">
<label class="custom-control-label" for="dateFormatMedium" i18n>Medium: {{today | customDate:'mediumDate'}}</label> <label class="custom-control-label" for="dateFormatMedium" i18n>Medium: {{today | customDate:'mediumDate':null:comptuedDateLocale}}</label>
</div> </div>
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" id="dateFormatLong" name="dateFormat" class="custom-control-input" formControlName="dateFormat" value="longDate"> <input type="radio" id="dateFormatLong" name="dateFormat" class="custom-control-input" formControlName="dateFormat" value="longDate">
<label class="custom-control-label" for="dateFormatLong" i18n>Long: {{today | customDate:'longDate'}}</label> <label class="custom-control-label" for="dateFormatLong" i18n>Long: {{today | customDate:'longDate':null:comptuedDateLocale}}</label>
</div> </div>
</div> </div>

View File

@ -30,6 +30,10 @@ export class SettingsComponent implements OnInit {
savedViews: PaperlessSavedView[] savedViews: PaperlessSavedView[]
get comptuedDateLocale(): string {
return this.settingsForm.value.dateLocale || this.settingsForm.value.displayLanguage
}
constructor( constructor(
public savedViewService: SavedViewService, public savedViewService: SavedViewService,
private documentListViewService: DocumentListViewService, private documentListViewService: DocumentListViewService,