Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
History: no workouts in the future, no sessions longer than a day
Duarte Santoscf9257ef923b
diff --git a/frontend/src/lib/workout-date.js b/frontend/src/lib/workout-date.jsindex 80628fe89..a860c47c6 100644--- a/frontend/src/lib/workout-date.js+++ b/frontend/src/lib/workout-date.js@@ -100,6 +100,15 @@ export function moveWorkout(workouts, ref, iso, time, now = Date.now()) {return rebuildPrHistory(filed, (current.entries || []).map(e => e.id), moved)}+// The longest a session can be said to have run: a day. Past that it is a typo (99999 read as+// 1666 hours), and a session ending weeks from now throws off every stat that sums time.+export const MAX_DURATION_MIN = 24 * 60++// Whether a session started on `iso` at `time` and running `minutes` would still be going on at+// `now`. Today's date with a later time passed the date check and filed the workout hours ahead.+export const endsInFuture = (iso, time, minutes, now = Date.now()) =>+ backfillStart(iso, time) + Math.max(0, Number(minutes) || 0) * 60000 > now+// How long a saved session ran, in whole minutes — what the duration row starts from. At least a// minute, the way a logged past session is at least one (backfillEnd).export const durationMinOf = w => Math.max(1, Math.round(Math.max(0, (w?.end ?? w?.start ?? 0) - (w?.start ?? 0)) / 60000))@@ -112,7 +121,7 @@ export const durationMinOf = w => Math.max(1, Math.round(Math.max(0, (w?.end ??export function setWorkoutDuration(workouts, ref, minutes, now = Date.now()) {const list = Array.isArray(workouts) ? workouts : []const current = list.find(w => sameWorkout(w, ref))- const min = Math.max(1, Math.round(Number(minutes) || 0))+ const min = Math.min(MAX_DURATION_MIN, Math.max(1, Math.round(Number(minutes) || 0)))if (!current || !Number.isFinite(current.start) || (current.end != null && min === durationMinOf(current))) return null// A record from before ids is keyed by its day and start, and neither moves here.const edited = stampWorkout({ ...current, end: current.start + min * 60000 }, now)diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex 4b01c4f2a..27eb8f09f 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -1947,4 +1947,6 @@ export default {'Make it a warm-up set': 'اجعلها مجموعة إحماء','Count it as a working set': 'احسبها مجموعة عمل','That looks too heavy. Keep it at {0} or less.': 'يبدو هذا ثقيلًا جدًا. الحد الأقصى {0}.',+ 'That’s still in the future. Try an earlier start.': 'هذا ما زال في المستقبل. جرّب وقت بدء أبكر.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'هذا أكثر من يوم. الحد الأقصى 24 ساعة.',}diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex b7c9bbd48..d9452f48c 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -1914,4 +1914,6 @@ export default {'Make it a warm-up set': 'Zum Aufwärmsatz machen','Count it as a working set': 'Als Arbeitssatz zählen','That looks too heavy. Keep it at {0} or less.': 'Das wirkt zu schwer. Höchstens {0}, bitte.',+ 'That’s still in the future. Try an earlier start.': 'Das liegt noch in der Zukunft. Probier eine frühere Startzeit.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Das ist mehr als ein Tag. Höchstens 24 Stunden, bitte.',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex a0d2f3bc7..d28febf52 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': 'Convertir en serie de calentamiento','Count it as a working set': 'Contar como serie efectiva','That looks too heavy. Keep it at {0} or less.': 'Eso parece demasiado. Como mucho {0}.',+ 'That’s still in the future. Try an earlier start.': 'Eso aún está en el futuro. Prueba con una hora de inicio anterior.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Eso es más de un día. Como mucho 24 horas.',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 1196b4887..b00ca43a1 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': 'En faire une série d’échauffement','Count it as a working set': 'Compter comme série de travail','That looks too heavy. Keep it at {0} or less.': 'Ça semble trop lourd. Pas plus de {0}.',+ 'That’s still in the future. Try an earlier start.': 'C’est encore dans le futur. Essaie une heure de début plus tôt.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'C’est plus d’une journée. Reste à 24 heures maximum.',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex abe42e656..8fbf9055a 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': 'इसे वार्म-अप सेट बनाएं','Count it as a working set': 'इसे वर्किंग सेट गिनें','That looks too heavy. Keep it at {0} or less.': 'यह बहुत भारी लग रहा है। ज़्यादा से ज़्यादा {0}।',+ 'That’s still in the future. Try an earlier start.': 'यह अभी भविष्य में है। थोड़ा पहले का शुरू होने का समय चुनें।',+ 'That’s more than a day. Keep it to 24 hours or less.': 'यह एक दिन से ज़्यादा है। ज़्यादा से ज़्यादा 24 घंटे।',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex e21791f31..f49ae01e5 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -1897,4 +1897,6 @@ export default {'Make it a warm-up set': 'Legyen bemelegítő sorozat','Count it as a working set': 'Számítson munkasorozatnak','That looks too heavy. Keep it at {0} or less.': 'Ez túl soknak tűnik. Legfeljebb {0}.',+ 'That’s still in the future. Try an earlier start.': 'Ez még a jövőben van. Próbálj korábbi kezdést.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Ez több mint egy nap. Legfeljebb 24 óra.',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 7a2c73279..bfe20ee5b 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': 'Rendila serie di riscaldamento','Count it as a working set': 'Conta come serie allenante','That looks too heavy. Keep it at {0} or less.': 'Sembra troppo. Al massimo {0}.',+ 'That’s still in the future. Try an earlier start.': 'È ancora nel futuro. Prova un orario di inizio precedente.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'È più di un giorno. Al massimo 24 ore.',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 57ef51f6c..8b760715f 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': '워밍업 세트로 바꾸기','Count it as a working set': '본 세트로 세기','That looks too heavy. Keep it at {0} or less.': '너무 무거워 보여요. 최대 {0}까지예요.',+ 'That’s still in the future. Try an earlier start.': '아직 미래예요. 더 이른 시작 시간을 골라 보세요.',+ 'That’s more than a day. Keep it to 24 hours or less.': '하루가 넘어요. 최대 24시간까지예요.',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 336a354e5..4c01d5ae5 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': 'Zamień na serię rozgrzewkową','Count it as a working set': 'Licz jako serię roboczą','That looks too heavy. Keep it at {0} or less.': 'To wygląda na za dużo. Maksymalnie {0}.',+ 'That’s still in the future. Try an earlier start.': 'To jeszcze przyszłość. Spróbuj wcześniejszej godziny startu.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'To ponad doba. Maksymalnie 24 godziny.',}diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex cecffb3af..d3b649dd6 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1173,6 +1173,8 @@ export const PT_BR_OVERRIDES = {'Build your loop in Plan': 'Monte seu ciclo no Plano','Finish and save': 'Terminar e salvar','That looks too heavy. Keep it at {0} or less.': 'Isso parece pesado demais. No máximo {0}.',+ 'That’s still in the future. Try an earlier start.': 'Isso ainda está no futuro. Tente um horário de início mais cedo.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Isso é mais de um dia. No máximo 24 horas.',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 62d3b99cc..13819cacb 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': 'Tornar série de aquecimento','Count it as a working set': 'Contar como série de trabalho','That looks too heavy. Keep it at {0} or less.': 'Isso parece pesado demais. No máximo {0}.',+ 'That’s still in the future. Try an earlier start.': 'Isso ainda está no futuro. Experimenta uma hora de início mais cedo.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Isso é mais de um dia. No máximo 24 horas.',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 7e709eda5..ee152d33f 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -1898,4 +1898,6 @@ export default {'Make it a warm-up set': 'Сделать разминочным подходом','Count it as a working set': 'Считать рабочим подходом','That looks too heavy. Keep it at {0} or less.': 'Это слишком много. Не больше {0}.',+ 'That’s still in the future. Try an earlier start.': 'Это ещё в будущем. Выбери время начала пораньше.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Это больше суток. Не больше 24 часов.',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 0c5c5ce68..26028f4a5 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -1905,4 +1905,6 @@ export default {'Make it a warm-up set': 'เปลี่ยนเป็นเซ็ตวอร์มอัพ','Count it as a working set': 'นับเป็นเซ็ตจริง','That looks too heavy. Keep it at {0} or less.': 'ดูหนักเกินไปนะ ใส่ได้ไม่เกิน {0}',+ 'That’s still in the future. Try an earlier start.': 'ยังเป็นเวลาในอนาคตอยู่เลย ลองเวลาเริ่มที่เร็วกว่านี้',+ 'That’s more than a day. Keep it to 24 hours or less.': 'เกินหนึ่งวันแล้ว ใส่ได้ไม่เกิน 24 ชั่วโมง',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 111f739dc..98bbf707a 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': 'Isınma setine çevir','Count it as a working set': 'Çalışma seti say','That looks too heavy. Keep it at {0} or less.': 'Bu fazla ağır görünüyor. En fazla {0}.',+ 'That’s still in the future. Try an earlier start.': 'Bu hâlâ gelecekte. Daha erken bir başlangıç dene.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Bu bir günden fazla. En fazla 24 saat.',}diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex bd501e491..73e85b446 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -1891,4 +1891,6 @@ export default {'Make it a warm-up set': 'Зробити розминковим підходом','Count it as a working set': 'Рахувати робочим підходом','That looks too heavy. Keep it at {0} or less.': 'Це забагато. Не більше {0}.',+ 'That’s still in the future. Try an earlier start.': 'Це ще в майбутньому. Вибери ранніший час початку.',+ 'That’s more than a day. Keep it to 24 hours or less.': 'Це більше доби. Не більше 24 годин.',}diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex eb18b3cb2..4e0c91b75 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -1887,4 +1887,6 @@ export default {'Make it a warm-up set': '改為熱身組','Count it as a working set': '算作正式組','That looks too heavy. Keep it at {0} or less.': '這好像太重了。最多 {0}。',+ 'That’s still in the future. Try an earlier start.': '這還在未來。試試更早的開始時間。',+ 'That’s more than a day. Keep it to 24 hours or less.': '超過一天了。最多 24 小時。',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex c7863df4c..1559b1c45 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -1894,4 +1894,6 @@ export default {'Make it a warm-up set': '改为热身组','Count it as a working set': '算作正式组','That looks too heavy. Keep it at {0} or less.': '这好像太重了。最多 {0}。',+ 'That’s still in the future. Try an earlier start.': '这还在未来。试试更早的开始时间。',+ 'That’s more than a day. Keep it to 24 hours or less.': '超过一天了。最多 24 小时。',}diff --git a/frontend/src/sheets.backfill.test.jsx b/frontend/src/sheets.backfill.test.jsxindex 326939b1a..d0699bbad 100644--- a/frontend/src/sheets.backfill.test.jsx+++ b/frontend/src/sheets.backfill.test.jsx@@ -29,11 +29,15 @@ const cssSource = readFileSync(resolve(process.cwd(), 'src/index.css'), 'utf8')describe('log a past workout', () => {beforeEach(() => {globalThis.IS_REACT_ACT_ENVIRONMENT = true+ // Late in the evening, so the default 18:00 start on today's date is already over: a past+ // session has to have ended before now.+ vi.useFakeTimers({ toFake: ['Date'] })+ vi.setSystemTime(new Date(2026, 7, 26, 21, 0))useUI.setState({ sheets: [], toasts: [] })useStore.setState(s => ({ S: { ...s.S, active: null, routines: [], workouts: [{ id: 'old', d: todayISO(), start: 1, end: 2, name: 'Old', entries: [], prs: [] }] } }))document.body.innerHTML = ''})- afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })+ afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }); vi.useRealTimers() })it('refuses while a workout is running', () => {const toast = vi.fn()@@ -129,4 +133,26 @@ describe('log a past workout', () => {act(() => { button(host, 'Continue').click() })expect(useStore.getState().S.active.backfill.durationMin).toBe(1)})++ it('refuses a session that would still be running now, and one longer than a day', () => {+ useUI.setState({ toast: vi.fn() })+ vi.setSystemTime(new Date(2026, 7, 26, 1, 42))+ {+ logPastWorkoutSheet()+ const host = mountTopSheet()+ act(() => { type(host.querySelector('input[type=date]'), '2026-08-26') })+ act(() => { type(host.querySelector('input[type=time]'), '23:30') })+ act(() => { button(host, 'Continue').click() })+ expect(useStore.getState().S.active).toBeFalsy()+ expect(useUI.getState().toast).toHaveBeenLastCalledWith('That’s still in the future. Try an earlier start.')+ act(() => { type(host.querySelector('input[type=date]'), '2026-08-20') })+ act(() => { type(host.querySelector('input.num'), '99999') })+ expect(host.textContent).toContain('That’s more than a day. Keep it to 24 hours or less.')+ act(() => { button(host, 'Continue').click() })+ expect(useStore.getState().S.active).toBeFalsy()+ act(() => { type(host.querySelector('input.num'), '90') })+ act(() => { button(host, 'Continue').click() })+ expect(useStore.getState().S.active.d).toBe('2026-08-20')+ }+ })})diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 8b2750fb6..d0676a2ba 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -49,7 +49,7 @@ import { buildSessionEntries, buildPlannedEntry, builtOutOfProgression } from '.import { joinSessionNoProg } from './lib/session-noprog.js'import { buildCombinedEntries, deriveSessionName } from './lib/session-merge.js'import { workoutsOn, backfillStart, backfillEnd, completeBackfill, historyAsOf, sessionHistory } from './lib/backfill.js'-import { moveWorkout, sameWorkout, startTimeOf, durationMinOf, setWorkoutDuration, rebuildPrHistory } from './lib/workout-date.js'+import { moveWorkout, sameWorkout, startTimeOf, durationMinOf, setWorkoutDuration, rebuildPrHistory, MAX_DURATION_MIN, endsInFuture } from './lib/workout-date.js'import { editCompletedSession, editLeftEmpty, editedRecord, editChangesNothing } from './lib/session-edit.js'import { stampWorkout } from './lib/sync-merge.js'import { weeklyWeights } from './lib/bodyweight.js'@@ -2051,6 +2051,8 @@ function WorkoutDateEdit({ w, onDone, close }) {// sheet both just close.if (date === w.d && time === startTimeOf(w)) { close(); return }if (!(S().workouts || []).some(x => sameWorkout(x, w))) { close(); return }+ // It keeps its length, so the end it would have is what has to be in the past.+ if (endsInFuture(date, time, durationMinOf(w))) { toast(t('That’s still in the future. Try an earlier start.')); return }update(s => {const next = moveWorkout(s.workouts, w, date, time)if (next) s.workouts = next@@ -2080,8 +2082,10 @@ function WorkoutDurationEdit({ w, onDone, close }) {// A cleared field reads as 0, and saving that made the session one minute long without a word// (QA 1.3.9): it is refused with the reason under the field, and the saved length stays.const durInvalid = !(dur >= 1)+ const durTooLong = dur > MAX_DURATION_MINconst save = () => {if (durInvalid) { toast(t('Enter how long it took (at least 1 minute).')); return }+ if (durTooLong) { toast(t('That’s more than a day. Keep it to 24 hours or less.')); return }let changed = falseupdate(s => {const next = setWorkoutDuration(s.workouts, w, dur) // at least a minute, however the field was left@@ -2096,8 +2100,10 @@ function WorkoutDurationEdit({ w, onDone, close }) {<h3>{t('Change duration')}</h3><div className="muted small" style={{ marginBottom: 12 }}>{t('Forgot to finish on time? Set how long the session really took. It keeps its start time and its sets.')}</div>{/* min 0, not 1: the stepper would put a cleared field back to 1 as it lost focus to Save. */}- <Stepper label={t('Duration')} unit={t('min')} value={dur} step={5} min={0} decimal={false} invalid={durInvalid} onChange={v => setDur(Math.round(v))} />+ {/* No max either: one would cut a typo down to a day on blur and save that without a word. */}+ <Stepper label={t('Duration')} unit={t('min')} value={dur} step={5} min={0} decimal={false} invalid={durInvalid || durTooLong} onChange={v => setDur(Math.round(v))} />{durInvalid && <div className="small" style={{ color: 'var(--red)', marginTop: 6 }}>{t('Enter how long it took (at least 1 minute).')}</div>}+ {durTooLong && <div className="small" style={{ color: 'var(--red)', marginTop: 6 }}>{t('That’s more than a day. Keep it to 24 hours or less.')}</div>}<div style={{ height: 18 }} /><Button variant="primary" onClick={save}>{t('Save')}</Button></>@@ -2407,6 +2413,8 @@ function LogPastWorkout({ initial, close }) {const submit = () => {if (!date || date > today) { toast(t('Pick a day up to today')); return }if (!(dur >= 1)) { toast(t('Enter how long it took (at least 1 minute).')); return }+ if (dur > MAX_DURATION_MIN) { toast(t('That’s more than a day. Keep it to 24 hours or less.')); return }+ if (endsInFuture(date, time, dur)) { toast(t('That’s still in the future. Try an earlier start.')); return }const existing = workoutsOn(st, date)if (!existing.length) { go(null); return }ui().openSheet(c => <SameDayChoice iso={date} existing={existing} close={c}@@ -2420,8 +2428,9 @@ function LogPastWorkout({ initial, close }) {<input type="date" className="timef" value={date} max={today} onChange={e => setDate(e.target.value)} /></Row><Row icon="clock" title={t('Start time')}><input type="time" className="timef" value={time} onChange={e => setTime(e.target.value)} /></Row>- <Stepper label={t('Duration')} unit={t('min')} value={dur} step={5} min={0} decimal={false} invalid={!(dur >= 1)} onChange={v => setDur(Math.round(v))} />+ <Stepper label={t('Duration')} unit={t('min')} value={dur} step={5} min={0} decimal={false} invalid={!(dur >= 1) || dur > MAX_DURATION_MIN} onChange={v => setDur(Math.round(v))} />{!(dur >= 1) && <div className="small" style={{ color: 'var(--red)', marginTop: 6 }}>{t('Enter how long it took (at least 1 minute).')}</div>}+ {dur > MAX_DURATION_MIN && <div className="small" style={{ color: 'var(--red)', marginTop: 6 }}>{t('That’s more than a day. Keep it to 24 hours or less.')}</div>}<div style={{ height: 8 }} /><SelectRow icon="dumbbell" title={t('Routine')} value={routineId} options={options} onChange={setRoutineId} /><div style={{ height: 18 }} />diff --git a/frontend/src/sheets.workoutdate.test.jsx b/frontend/src/sheets.workoutdate.test.jsxindex a31147667..b198246e0 100644--- a/frontend/src/sheets.workoutdate.test.jsx+++ b/frontend/src/sheets.workoutdate.test.jsx@@ -102,6 +102,26 @@ describe('changing the date of a saved workout', () => {expect(useUI.getState().toast).toHaveBeenCalledWith('Pick a day up to today')})+ // At 01:42, today at 23:30 passed the date check and filed the session 22 hours ahead.+ it('refuses a time today that has not happened yet, counting the length it keeps', () => {+ vi.useFakeTimers({ toFake: ['Date'] })+ vi.setSystemTime(new Date(2026, 7, 26, 1, 42))+ try {+ const before = history()+ const host = render(() => workoutDateSheet(before[1])) // 47 minutes long+ act(() => { type(host.querySelector('input[type=date]'), '2026-08-26') })+ for (const time of ['23:30', '01:00']) {+ act(() => { type(host.querySelector('input[type=time]'), time) })+ act(() => { button(host, 'Save').click() })+ expect(history(), time).toEqual(before)+ expect(useUI.getState().toast).toHaveBeenLastCalledWith('That’s still in the future. Try an earlier start.')+ }+ act(() => { type(host.querySelector('input[type=time]'), '00:50') })+ act(() => { button(host, 'Save').click() })+ expect(history().find(w => w.id === 'late').d).toBe('2026-08-26')+ } finally { vi.useRealTimers() }+ })+it('saving without changing anything closes and touches nothing', () => {const before = history()const host = render(() => workoutDateSheet(before[1]))@@ -254,6 +274,22 @@ describe('changing the duration of a saved workout', () => {expect(history()[1].end - history()[1].start).toBe(40 * 60000)})+ // 99999 minutes saved as '1666h 39m', ending weeks from now.+ it('refuses more than a day, says why under the field, and keeps the saved length', () => {+ const before = history()[1]+ const host = render(() => workoutDurationSheet(before))+ const field = host.querySelector('input.num')+ act(() => { type(field, '99999') })+ expect(host.textContent).toContain('That’s more than a day. Keep it to 24 hours or less.')+ act(() => { button(host, 'Save').click() })+ expect(history()[1]).toEqual(before)+ expect(useUI.getState().toast).toHaveBeenLastCalledWith('That’s more than a day. Keep it to 24 hours or less.')+ act(() => { type(field, '1440') })+ expect(host.textContent).not.toContain('more than a day')+ act(() => { button(host, 'Save').click() })+ expect(history()[1].end - history()[1].start).toBe(1440 * 60000)+ })+it('saving the same length closes and touches nothing', () => {const before = history()const host = render(() => workoutDurationSheet(before[1]))