Skip to content

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.

Coach: dates in the local day, not the UTC one

Duarte Santosa0024cd1ff2e
diff --git a/frontend/src/components/CoachConsentSheet.jsx b/frontend/src/components/CoachConsentSheet.jsx
index e1420673c..1726a5c7e 100644
--- a/frontend/src/components/CoachConsentSheet.jsx
+++ b/frontend/src/components/CoachConsentSheet.jsx
@@ -8,7 +8,7 @@ import { useEffect, useState } from 'react'
import { useUI } from '../store/useUI.js'
import { useStore } from '../store/useStore.js'
import { t } from '../lib/i18n.js'
-import { fmtDate } from '../lib/format.js'
+import { fmtDate, isoOf } from '../lib/format.js'
import { DATA_CATEGORIES } from '../../../api/coach/core/categories.js'
import { aiConsents, withdrawAi, onAiConsentChange } from '../lib/coach-consent.js'
import { emptyCoach } from '../lib/coach.js'
@@ -85,7 +85,7 @@ export function AiConsentSection() {
footer={t('Who the Coach may send your training to from this device. Withdraw it and the Coach asks again next time. A model on your own network never needs asking.')}>
{!list.length && <Row icon="lock" iconTint="var(--green)" title={t('Nothing allowed yet')} subtitle={t('The Coach asks before anything leaves.')} />}
{list.map(c => <Row key={c.key} icon="shield" iconTint="var(--acc)" title={c.name}
- subtitle={(c.via === 'server' ? t('Through your server') : t('With your API key')) + ' · ' + t('Allowed {0}', fmtDate(String(c.at).slice(0, 10), false, true))}>
+ subtitle={(c.via === 'server' ? t('Through your server') : t('With your API key')) + ' · ' + t('Allowed {0}', fmtDate(isoOf(new Date(c.at)), false, true))}>
<Button size="sm" onClick={() => withdraw(c)}>{t('Withdraw')}</Button>
</Row>)}
</Section>
diff --git a/frontend/src/views/CoachChat.jsx b/frontend/src/views/CoachChat.jsx
index 05952205a..5c7466321 100644
--- a/frontend/src/views/CoachChat.jsx
+++ b/frontend/src/views/CoachChat.jsx
@@ -18,7 +18,7 @@ import { closeThenNav } from '../lib/nav.js'
import { useStore } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { t, tn } from '../lib/i18n.js'
-import { fmtDate, fmtNum, DAYS, weekOrder, weekStartOf } from '../lib/format.js'
+import { fmtDate, fmtNum, DAYS, weekOrder, weekStartOf, isoOf } from '../lib/format.js'
import { exLine } from '../lib/history.js'
import { speedUnitOf } from '../lib/speed.js'
import { DEMO } from '../lib/demo.js'
@@ -272,7 +272,7 @@ const stamp = at => {
const d = new Date(at)
const today = new Date()
const time = d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
- return d.toDateString() === today.toDateString() ? time : fmtDate(d.toISOString().slice(0, 10)) + ' · ' + time
+ return d.toDateString() === today.toDateString() ? time : fmtDate(isoOf(d)) + ' · ' + time
}
function Typing({ S, kind, coachLocal, config }) {
@@ -627,7 +627,7 @@ function ProposalDetail({ entry, S }) {
const weekDays = useMemo(() => new Set(Object.keys(b?.week || {}).map(Number)), [b])
return <div className="pdetail">
<div className="pcard-hd" style={{ paddingInline: 0 }}>
- <div className="pcard-eyebrow">{kind === 'create' ? t('Plan') : kind === 'debrief' ? t('Workout debrief') : t('Suggestions')} · {fmtDate(new Date(entry.at).toISOString().slice(0, 10))}</div>
+ <div className="pcard-eyebrow">{kind === 'create' ? t('Plan') : kind === 'debrief' ? t('Workout debrief') : t('Suggestions')} · {fmtDate(isoOf(new Date(entry.at)))}</div>
<h2 className="pcard-h">{kind === 'create' ? (b?.name || t('Coach plan')) : kind === 'debrief' ? (entry.workout?.name || t('Workout')) : tn('{0} suggestion', '{0} suggestions', entry.decisions?.length || 0)}</h2>
{!!entry.summary && <p className="pcard-sum">{entry.summary}</p>}
{entry.dismissed && <p className="pcard-sum" style={{ color: 'var(--red)' }}>{t('You declined this.')}</p>}
@@ -675,7 +675,7 @@ function HistorySheet({ S, close, openSheet }) {
: e.kind === 'debrief' ? t('Debrief: {0}', e.workout?.name || t('Workout')) + (e.score != null ? ` · ${e.score}/10` : '')
: e.kind === 'revert' ? t('Reverted the last Coach changes.')
: tn('{0} suggestion', '{0} suggestions', n)
- const sub = fmtDate(new Date(e.at).toISOString().slice(0, 10)) + ' · ' + (e.kind === 'debrief' ? String(e.summary || '').slice(0, 60)
+ const sub = fmtDate(isoOf(new Date(e.at))) + ' · ' + (e.kind === 'debrief' ? String(e.summary || '').slice(0, 60)
: e.dismissed ? t('Declined') : e.kind === 'create' ? t('Imported') : e.kind === 'revert' ? '' : t('{0} accepted · {1} declined', acc, n - acc))
return <Row key={e.id} icon={ic} iconTint={tint} title={title} subtitle={sub} accessory="chevron"
onClick={() => { close(); openSheet(() => <ProposalDetail entry={e} S={S} />) }} />