diff --git a/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.html b/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.html index 6179fc5..cded19a 100644 --- a/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.html +++ b/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.html @@ -5,7 +5,7 @@
River of Life · 生命河靈糧堂

Sunday Worship Count主日崇拜人數統計

-
{{ today | date:'fullDate' }}
+
{{ worshipSunday | date:'fullDate' }}
{{ connected ? 'Live · 即時連線中' : 'Connecting… · 連線中' }} diff --git a/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.ts b/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.ts index b0fcb1a..094bce6 100644 --- a/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.ts +++ b/APP/src/app/features/meal-attendance/pages/attendance-counter-page/attendance-counter-page.component.ts @@ -19,8 +19,20 @@ interface CounterRow { styleUrls: ['./attendance-counter-page.component.scss'], }) export class AttendanceCounterPageComponent implements OnInit, OnDestroy { - /** Auto-selected current day shown in the header. */ - readonly today = new Date(); + /** + * Auto-selected Sunday of the current week, shown in the header. + * Sunday is the first day of the week, so this is the Sunday on or before today: + * getDay() returns 0 on Sunday (no shift) and 1–6 on Mon–Sat (step back that many days). + */ + readonly worshipSunday = this.currentWeekSunday(); + + /** The Sunday that opens the week containing today. */ + private currentWeekSunday(): Date { + const now = new Date(); + const sunday = new Date(now.getFullYear(), now.getMonth(), now.getDate()); + sunday.setDate(sunday.getDate() - now.getDay()); + return sunday; + } readonly rows: CounterRow[] = [ { key: 'adult', labelEn: 'Adult', labelZh: '成人' },