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
add date format parse and tests
andi242881fe4b2dcec
diff --git a/frontend/src/lib/import-csv.js b/frontend/src/lib/import-csv.jsindex 73a9bd212..764950792 100644--- a/frontend/src/lib/import-csv.js+++ b/frontend/src/lib/import-csv.js@@ -258,10 +258,10 @@ const LB_TO_KG = 0.45359237const p2 = n => String(n).padStart(2, '0')const MON = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }-/** "2020-12-30 18:51:52" · "2024-03-07" · "22 Dec 2025, 08:00" · "07/03/2024" -> { d, t } */+/** "2020-12-30 18:51:52" · "2024-03-07" · "2024/03/07" · "2024.03.07" · "22 Dec 2025, 08:00" · "07/03/2024" -> { d, t } */export function parseWhen(s) {const v = String(s || '').trim()- let m = v.match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T ](\d{1,2}):(\d{2}))?/)+ let m = v.match(/^(\d{4})[-/.](\d{1,2})[-/.](\d{1,2})(?:[T ](\d{1,2}):(\d{2}))?/)if (m) return { d: `${m[1]}-${p2(m[2])}-${p2(m[3])}`, t: hm(m[4], m[5]) }m = v.match(/^(\d{1,2})\s+([A-Za-z]{3})[a-z]*\.?\s+(\d{4})(?:,?\s+(\d{1,2}):(\d{2}))?/)if (m && MON[m[2].toLowerCase()]) return { d: `${m[3]}-${p2(MON[m[2].toLowerCase()])}-${p2(m[1])}`, t: hm(m[4], m[5]) }diff --git a/frontend/src/lib/import-csv.test.js b/frontend/src/lib/import-csv.test.jsindex 4a8b1647b..346c7153f 100644--- a/frontend/src/lib/import-csv.test.js+++ b/frontend/src/lib/import-csv.test.js@@ -4,7 +4,9 @@ import { parseWorkoutCSV } from './import-csv.js'const CSV = ['Date,Exercise,Weight,Reps,Set Type','2026-08-08,Bench Press,100,5,Warm-up',- '2026-08-08,Bench Press,80,5,Working',+ '2026.08.08,Bench Press,80,5,Working',+ '8 Aug 2026,Bench Press,80,5,Working',+ '2026/08/08,Bench Press,85,3,Working',].join('\n')describe('CSV warm-up provenance', () => {@@ -16,7 +18,9 @@ describe('CSV warm-up provenance', () => {expect(entry.sets).toEqual([{ w: 100, r: 5, done: true, phase: 'warmup' },{ w: 80, r: 5, done: true },+ { w: 80, r: 5, done: true },+ { w: 85, r: 3, done: true },])- expect(entry.topW).toBe(80)+ expect(entry.topW).toBe(85)})-})\ No newline at end of file+})