File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
frontend/src/components/utils Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,18 @@ export const formatDateForInput = (date?: string | null) => {
55 if ( ! date ) return "" ;
66 const localDate = new Date ( date ) ;
77 if ( isNaN ( localDate . getTime ( ) ) ) return "" ;
8- // Convertir en "YYYY-MM-DDTHH:mm"
9- return localDate . toISOString ( ) . slice ( 0 , 16 ) ;
8+
9+ // Construire YYYY-MM-DDTHH:mm en LOCAL
10+ const year = localDate . getFullYear ( ) ;
11+ const month = String ( localDate . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) ;
12+ const day = String ( localDate . getDate ( ) ) . padStart ( 2 , "0" ) ;
13+ const hours = String ( localDate . getHours ( ) ) . padStart ( 2 , "0" ) ;
14+ const minutes = String ( localDate . getMinutes ( ) ) . padStart ( 2 , "0" ) ;
15+
16+ return `${ year } -${ month } -${ day } T${ hours } :${ minutes } ` ;
1017} ;
1118
19+
1220// Pour envoyer vers la DB
1321// On reçoit une string "YYYY-MM-DDTHH:mm" venant de l'input datetime-local
1422// On la convertit en UTC ISO (toujours ce que ta DB attend)
You can’t perform that action at this time.
0 commit comments