feat(ui) : MalioDate/DateTime exposent update:valid + saisie clavier DateTime (#MUI-43)

- MalioDate : event update:valid (malforme/hors-plage => false), emis au montage
- MalioDateTime : prop editable (saisie JJ/MM/AAAA HH:MM) + meme update:valid
- CalendarField : masque maska configurable via prop mask
- datetimeFormat : nouveau parseur parseDisplayToIsoDateTime
- fix test Date « Entree » (key 'Enter' reel vs trigger keydown.enter)
- doc COMPONENTS.md + CHANGELOG.md + champ editable dans le playground

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 16:03:04 +02:00
parent 23a9729dcd
commit fee894e895
10 changed files with 350 additions and 18 deletions
@@ -1,4 +1,4 @@
import {isValidIso} from './dateFormat'
import {isValidIso, parseDisplayToIso} from './dateFormat'
const DATETIME_RE = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2}):(\d{2})$/
@@ -27,6 +27,16 @@ export function splitDateTime(s: string | null): {date: string | null; time: str
return {date, time: time.slice(0, 5)}
}
export function parseDisplayToIsoDateTime(display: string): string | null {
const match = /^(\d{2}\/\d{2}\/\d{4}) (\d{2}):(\d{2})$/.exec(display.trim())
if (!match) return null
const [, datePart, hh, mm] = match
const iso = parseDisplayToIso(datePart)
if (!iso) return null
if (Number(hh) > 23 || Number(mm) > 59) return null
return `${iso}T${hh}:${mm}:00`
}
export function composeDateTime(date: string, time: string): string {
const t = time || '00:00'
return `${date}T${t}:00`