fix: MalioDate + MalioDateTime (#72)
Release / release (push) Successful in 1m10s

| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|                  |                 |

## Description de la PR

## Modification du .env

## Check list

- [ ] Pas de régression
- [x] TU/TI/TF rédigée
- [x] TU/TI/TF OK
- [x] CHANGELOG modifié

---------

Co-authored-by: admin malio <malio@yuno.malio.fr>
Co-authored-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr>
Co-authored-by: matthieu <matthieu@yuno.malio.fr>
Reviewed-on: #72
Co-authored-by: tristan <tristan@yuno.malio.fr>
Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit was merged in pull request #72.
This commit is contained in:
2026-06-11 15:46:43 +00:00
committed by Autin
parent 9f772a84ed
commit 90ed4a213f
12 changed files with 480 additions and 26 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`