feat(vocab): add SRS schedule date formatting and update close button text

This commit is contained in:
Torsten Schulz (local)
2026-08-26 09:53:30 +02:00
parent a481a440c8
commit bac915c328
2 changed files with 21 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ import { Op } from 'sequelize';
import { BISAYA_PHASE1_DIDACTICS, BISAYA_DIDACTICS_FRAGMENTS } from '../scripts/bisaya-course-phase1.js'; import { BISAYA_PHASE1_DIDACTICS, BISAYA_DIDACTICS_FRAGMENTS } from '../scripts/bisaya-course-phase1.js';
const DAILY_SRS_LIMIT = 50; const DAILY_SRS_LIMIT = 50;
const SRS_SCHEDULE_TIME_ZONE = 'Europe/Berlin';
export default class VocabService { export default class VocabService {
_stripGermanNumberSeparators(value) { _stripGermanNumberSeparators(value) {
@@ -317,6 +318,21 @@ export default class VocabService {
return date.toISOString(); 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 } = {}) { _clampInteger(value, { min = 0, max = 100000, fallback = 0 } = {}) {
const numeric = Number(value); const numeric = Number(value);
if (!Number.isFinite(numeric)) { if (!Number.isFinite(numeric)) {
@@ -2043,8 +2059,10 @@ export default class VocabService {
&& new Date(item.nextDueAt).getTime() > now.getTime() && new Date(item.nextDueAt).getTime() > now.getTime()
)) ))
.forEach((item) => { .forEach((item) => {
const date = new Date(item.nextDueAt).toISOString().slice(0, 10); const date = this._getSrsScheduleDateKey(item.nextDueAt);
upcomingByDate.set(date, (upcomingByDate.get(date) || 0) + 1); if (date) {
upcomingByDate.set(date, (upcomingByDate.get(date) || 0) + 1);
}
}); });
const rows = validDueRows.slice(0, limit); const rows = validDueRows.slice(0, limit);
const totalDueCount = validDueRows.length; const totalDueCount = validDueRows.length;

View File

@@ -327,7 +327,7 @@
</li> </li>
</ul> </ul>
<div class="form-actions"> <div class="form-actions">
<button type="button" class="button-secondary" @click="showIntensiveStatusDialog = false">{{ $t('general.close') }}</button> <button type="button" class="button-secondary" @click="showIntensiveStatusDialog = false">{{ $t('message.close') }}</button>
</div> </div>
</section> </section>
</div> </div>