Repository navigation
Import: read localized month names in CSV dates - #273
Conversation
A French Hevy export lost seven months out of twelve: parseWhen only knew
English month abbreviations and [A-Za-z]{3}, so févr./août/déc. never matched
and avr./mai/juin/juil. matched but meant nothing. Rows were dropped as skipped.
Month words are now read in fr/es/pt/de/nl/it, accent-insensitive, with a
4-letter lookup so juin and juil. stay apart.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add Dutch March support and protect month lookups from inherited properties.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Adds accent-insensitive localized month parsing for CSV imports across several European languages, with French regression coverage.
Changes:
- Supports localized month names and four-letter disambiguation.
- Adds Unicode-aware parsing.
- Adds date and full-import tests.
| File | Summary |
|---|---|
frontend/src/lib/import-csv.js |
Adds localized month lookup and parsing. P1 (moderate, 3 votes): add Dutch March spellings. P2 (moderate, 3 votes): guard lookups against inherited properties. |
frontend/src/lib/import-csv.test.js |
Adds localized date and French import regression tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // Spanish · Portuguese | ||
| ene: 1, fev: 2, abr: 4, ago: 8, set: 9, out: 10, dic: 12, | ||
| // German · Dutch | ||
| mrz: 3, mei: 5, okt: 10, dez: 12, |
| /** A month word in any of the languages above -> 1-12, or null. */ | ||
| const monthOf = w => { | ||
| const k = String(w || '').normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase() | ||
| return MON[k] || MON[k.slice(0, 4)] || MON[k.slice(0, 3)] || null |
…shortened to mrt. (#273)
|
Thanks @sTOrM2202, French and other localized CSV exports now keep all twelve months. One gap I noticed: Dutch "maart" still isn't matched, because "maar" isn't a prefix in the table. That's a one-line PR if anyone wants it. Released in v1.3.9: https://github.com/DuarteSantos8/openGym/releases/tag/v1.3.9 |

A French Hevy export lost seven months out of twelve: parseWhen only knew English month abbreviations and [A-Za-z]{3}, so févr./août/déc. never matched and avr./mai/juin/juil. matched but meant nothing. Rows were dropped as skipped. Month words are now read in fr/es/pt/de/nl/it, accent-insensitive, with a 4-letter lookup so juin and juil. stay apart.