Skip to content

Import: read localized month names in CSV dates - #273

Merged
DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
sTOrM2202:fix/csv-localized-months
Sep 28, 2026
Merged

DuarteSantos8 merged 1 commit into
DuarteSantos8:mainfrom
sTOrM2202:fix/csv-localized-months

Conversation

@sTOrM2202

Copy link
Copy Markdown
Contributor

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.

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.
Copilot AI lite review requested due to automatic review settings September 21, 2026 10:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity

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
@DuarteSantos8
DuarteSantos8 merged commit 3bb3116 into DuarteSantos8:main Sep 28, 2026
DuarteSantos8 added a commit that referenced this pull request Sep 28, 2026
@DuarteSantos8

Copy link
Copy Markdown
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants