mirror of
https://github.com/immich-app/immich.git
synced 2026-05-13 11:02:15 -04:00
fix(web): correct timeline yesterday label across month boundaries (#28183)
This commit is contained in:
@@ -7,6 +7,9 @@ describe('formatGroupTitle', () => {
|
||||
beforeAll(() => {
|
||||
vi.useFakeTimers();
|
||||
process.env.TZ = 'UTC';
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.setSystemTime(new Date('2024-07-27T12:00:00Z'));
|
||||
});
|
||||
|
||||
@@ -31,6 +34,13 @@ describe('formatGroupTitle', () => {
|
||||
expect(formatGroupTitle(date)).toBe('hier');
|
||||
});
|
||||
|
||||
it('formats yesterday across month boundaries', () => {
|
||||
vi.setSystemTime(new Date('2024-05-01T12:00:00Z'));
|
||||
const date = parseUtcDate('2024-04-30T23:59:59Z');
|
||||
locale.set('en');
|
||||
expect(formatGroupTitle(date)).toBe('yesterday');
|
||||
});
|
||||
|
||||
it('formats last week', () => {
|
||||
const date = parseUtcDate('2024-07-21T00:00:00Z');
|
||||
locale.set('en');
|
||||
|
||||
@@ -128,7 +128,7 @@ export function formatGroupTitle(_date: DateTime): string {
|
||||
|
||||
// Yesterday
|
||||
if (today.minus({ days: 1 }).hasSame(date, 'day')) {
|
||||
return date.toRelativeCalendar({ locale: get(locale) });
|
||||
return date.toRelativeCalendar({ locale: get(locale), unit: 'days' });
|
||||
}
|
||||
|
||||
// Last week
|
||||
|
||||
Reference in New Issue
Block a user