mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-06 23:05:42 +01:00
Fix relative date display hint
This commit is contained in:
parent
e6b0b94ac4
commit
1bd3504593
2 changed files with 42 additions and 6 deletions
|
|
@ -26,7 +26,15 @@
|
|||
i18n-placeholder
|
||||
(change)="onSetCreatedRelativeDate($event)">
|
||||
<ng-template ng-option-tmp let-item="item">
|
||||
<div class="d-flex">{{ item.name }}<span class="ms-auto text-muted small">{{ item.date | customDate:'mediumDate' }} – <ng-container i18n>now</ng-container></span></div>
|
||||
<div class="d-flex">{{ item.name }}
|
||||
<span class="ms-auto text-muted small">
|
||||
@if (item.dateEnd) {
|
||||
{{ item.date | customDate:'MMM d' }} – {{ item.dateEnd | customDate:'mediumDate' }}
|
||||
} @else {
|
||||
{{ item.date | customDate:'mediumDate' }} – <ng-container i18n>now</ng-container>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
|
|
@ -102,7 +110,15 @@
|
|||
i18n-placeholder
|
||||
(change)="onSetAddedRelativeDate($event)">
|
||||
<ng-template ng-option-tmp let-item="item">
|
||||
<div class="d-flex">{{ item.name }}<span class="ms-auto text-muted small">{{ item.date | customDate:'mediumDate' }} – <ng-container i18n>now</ng-container></span></div>
|
||||
<div class="d-flex">{{ item.name }}
|
||||
<span class="ms-auto text-muted small">
|
||||
@if (item.dateEnd) {
|
||||
{{ item.date | customDate:'MMM d' }} – {{ item.dateEnd | customDate:'mediumDate' }}
|
||||
} @else {
|
||||
{{ item.date | customDate:'mediumDate' }} – <ng-container i18n>now</ng-container>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</ng-select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -118,22 +118,42 @@ export class DatesDropdownComponent implements OnInit, OnDestroy {
|
|||
{
|
||||
id: RelativeDate.PREVIOUS_WEEK,
|
||||
name: $localize`Previous week`,
|
||||
date: null,
|
||||
date: new Date(
|
||||
new Date().getFullYear(),
|
||||
new Date().getMonth(),
|
||||
new Date().getDate() - new Date().getDay() - 6
|
||||
),
|
||||
dateEnd: new Date(
|
||||
new Date().getFullYear(),
|
||||
new Date().getMonth(),
|
||||
new Date().getDate() - new Date().getDay()
|
||||
),
|
||||
},
|
||||
{
|
||||
id: RelativeDate.PREVIOUS_MONTH,
|
||||
name: $localize`Previous month`,
|
||||
date: null,
|
||||
date: new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1),
|
||||
dateEnd: new Date(new Date().getFullYear(), new Date().getMonth(), 0),
|
||||
},
|
||||
{
|
||||
id: RelativeDate.PREVIOUS_QUARTER,
|
||||
name: $localize`Previous quarter`,
|
||||
date: null,
|
||||
date: new Date(
|
||||
new Date().getFullYear(),
|
||||
Math.floor(new Date().getMonth() / 3) * 3 - 3,
|
||||
1
|
||||
),
|
||||
dateEnd: new Date(
|
||||
new Date().getFullYear(),
|
||||
Math.floor(new Date().getMonth() / 3) * 3,
|
||||
0
|
||||
),
|
||||
},
|
||||
{
|
||||
id: RelativeDate.PREVIOUS_YEAR,
|
||||
name: $localize`Previous year`,
|
||||
date: null,
|
||||
date: new Date('1/1/' + (new Date().getFullYear() - 1)),
|
||||
dateEnd: new Date('12/31/' + (new Date().getFullYear() - 1)),
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue