Alignments offset text fix for Five
This commit is contained in:
parent
5c3338fd9d
commit
9d12986720
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<button class="back" (click)="shiftAlignment(+1)">←</button>
|
<button class="back" (click)="shiftAlignment(+1)">←</button>
|
||||||
{{ alignment.display }}
|
{{ alignment.display }} {{ offset > 0 ? -offset : '' }}
|
||||||
<button class="next" (click)="shiftAlignment(-1)">→</button>
|
<button class="next" (click)="shiftAlignment(-1)">→</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -38,12 +38,26 @@ export class Alignment {
|
|||||||
} else if (offset === 1) {
|
} else if (offset === 1) {
|
||||||
return "Letzte 5 Minuten";
|
return "Letzte 5 Minuten";
|
||||||
}
|
}
|
||||||
const date = new Date();
|
|
||||||
date.setHours(date.getHours() - offset);
|
const today = new Date();
|
||||||
if (offset < 7) {
|
today.setMinutes(today.getMinutes() - today.getMinutes() % 5);
|
||||||
return `${formatDate(date, "EEEE", locale)}`;
|
|
||||||
|
const yesterday = new Date(today);
|
||||||
|
yesterday.setDate(yesterday.getDate() - 1);
|
||||||
|
|
||||||
|
const yesterday2 = new Date(today);
|
||||||
|
yesterday2.setDate(yesterday2.getDate() - 1);
|
||||||
|
|
||||||
|
const date = new Date(today);
|
||||||
|
date.setMinutes(date.getMinutes() - offset * 5);
|
||||||
|
if (date.getDay() === today.getDay()) {
|
||||||
|
return `${formatDate(date, "HH:mm", locale)}`;
|
||||||
|
} else if (date.getDay() === yesterday.getDay()) {
|
||||||
|
return `Gestern ${formatDate(date, "HH:mm", locale)}`;
|
||||||
|
} else if (date.getDay() === yesterday2.getDay()) {
|
||||||
|
return `Gestern ${formatDate(date, "HH:mm", locale)}`;
|
||||||
}
|
}
|
||||||
return `${formatDate(date, "EE", locale)} ${formatDate(date, "dd.MM.yyyy", locale)}`;
|
return `${formatDate(date, "EE", locale)} ${formatDate(date, "dd.MM.yyyy", locale)} ${formatDate(date, "HH:mm", locale)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
static offsetTitleHour(offset: number, locale: string): string {
|
static offsetTitleHour(offset: number, locale: string): string {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user