Locale data JS open

date-fns Galician formats June as xuño but cannot parse it back

Galician formats June as xuño but cannot parse it back

date-fns · date-fns/date-fns

Symptom

In the gl (Galician) locale the June parse pattern is /^xun/i. It matches the abbreviation "xun" but not the wide form "xuño", because the third character is ñ, not n. So format then parse round-trips fail for June; the locale's own snapshot already records Invalid Date for June while the other eleven months parse.

Minimal repro
const s = format(new Date(2021, 5, 1), 'MMMM', { locale: gl }); // 'xuño'
parse(s, 'MMMM', new Date(), { locale: gl });               // Invalid Date
Fix

Widen the June pattern to /^xu[nñ]/i so it matches both "xun" and "xuño" while staying distinct from July ("xul"), mirroring locales such as Catalan that already fold diacritics into their patterns (e.g. /^març/i).

Fix PR → #date-fns-gl-xuno-month-parse

Also in: JavaScript

← all 93 entries