High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(web): correct timeline yesterday label across month boundaries (#28183)
Michel Heusschen2015f95ff54d
diff --git a/web/src/lib/utils/timeline-util.spec.ts b/web/src/lib/utils/timeline-util.spec.tsindex 38e1c1b517..527cd04849 100644--- a/web/src/lib/utils/timeline-util.spec.ts+++ b/web/src/lib/utils/timeline-util.spec.ts@@ -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');diff --git a/web/src/lib/utils/timeline-util.ts b/web/src/lib/utils/timeline-util.tsindex d9063603e8..36f5b18d8d 100644--- a/web/src/lib/utils/timeline-util.ts+++ b/web/src/lib/utils/timeline-util.ts@@ -128,7 +128,7 @@ export function formatGroupTitle(_date: DateTime): string {// Yesterdayif (today.minus({ days: 1 }).hasSame(date, 'day')) {- return date.toRelativeCalendar({ locale: get(locale) });+ return date.toRelativeCalendar({ locale: get(locale), unit: 'days' });}// Last week