From bac915c328dbfd9f87b3e9ab7a2cc6f34b6a302f Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 26 Aug 2026 09:53:30 +0200 Subject: [PATCH] feat(vocab): add SRS schedule date formatting and update close button text --- backend/services/vocabService.js | 22 +++++++++++++++++-- frontend/src/views/social/VocabCourseView.vue | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/backend/services/vocabService.js b/backend/services/vocabService.js index bdf12bb..b35f0a5 100755 --- a/backend/services/vocabService.js +++ b/backend/services/vocabService.js @@ -16,6 +16,7 @@ import { Op } from 'sequelize'; import { BISAYA_PHASE1_DIDACTICS, BISAYA_DIDACTICS_FRAGMENTS } from '../scripts/bisaya-course-phase1.js'; const DAILY_SRS_LIMIT = 50; +const SRS_SCHEDULE_TIME_ZONE = 'Europe/Berlin'; export default class VocabService { _stripGermanNumberSeparators(value) { @@ -317,6 +318,21 @@ export default class VocabService { return date.toISOString(); } + _getSrsScheduleDateKey(value) { + const date = value instanceof Date ? value : new Date(value); + if (Number.isNaN(date.getTime())) { + return ''; + } + const parts = new Intl.DateTimeFormat('en-US', { + timeZone: SRS_SCHEDULE_TIME_ZONE, + year: 'numeric', + month: '2-digit', + day: '2-digit' + }).formatToParts(date); + const byType = new Map(parts.map((part) => [part.type, part.value])); + return `${byType.get('year')}-${byType.get('month')}-${byType.get('day')}`; + } + _clampInteger(value, { min = 0, max = 100000, fallback = 0 } = {}) { const numeric = Number(value); if (!Number.isFinite(numeric)) { @@ -2043,8 +2059,10 @@ export default class VocabService { && new Date(item.nextDueAt).getTime() > now.getTime() )) .forEach((item) => { - const date = new Date(item.nextDueAt).toISOString().slice(0, 10); - upcomingByDate.set(date, (upcomingByDate.get(date) || 0) + 1); + const date = this._getSrsScheduleDateKey(item.nextDueAt); + if (date) { + upcomingByDate.set(date, (upcomingByDate.get(date) || 0) + 1); + } }); const rows = validDueRows.slice(0, limit); const totalDueCount = validDueRows.length; diff --git a/frontend/src/views/social/VocabCourseView.vue b/frontend/src/views/social/VocabCourseView.vue index 5afd5ea..21906ea 100755 --- a/frontend/src/views/social/VocabCourseView.vue +++ b/frontend/src/views/social/VocabCourseView.vue @@ -327,7 +327,7 @@
- +