@@ -128,13 +128,39 @@ export default function CreatePoll() {
128
128
const onSubmit = async ( data : CreatePollForm ) => {
129
129
setIsSubmitting ( true ) ;
130
130
try {
131
+ // Convert local deadline to UTC before sending to backend
132
+ let utcDeadline : string | undefined ;
133
+ if ( data . deadline ) {
134
+ // Create a Date object from the local datetime-local input
135
+ const localDate = new Date ( data . deadline ) ;
136
+ // Convert to UTC ISO string
137
+ utcDeadline = localDate . toISOString ( ) ;
138
+
139
+ // Show user the timezone conversion for transparency
140
+ const localTime = localDate . toLocaleString ( ) ;
141
+ const utcTime = new Date ( utcDeadline ) . toLocaleString ( 'en-US' , { timeZone : 'UTC' } ) ;
142
+
143
+ console . log ( '🕐 Deadline conversion:' , {
144
+ local : data . deadline ,
145
+ localTime,
146
+ utc : utcDeadline ,
147
+ utcTime
148
+ } ) ;
149
+
150
+ toast ( {
151
+ title : "Timezone Converted" ,
152
+ description : `Local: ${ localTime } → UTC: ${ utcTime } ` ,
153
+ duration : 3000 ,
154
+ } ) ;
155
+ }
156
+
131
157
await pollApi . createPoll ( {
132
158
title : data . title ,
133
159
mode : data . mode ,
134
160
visibility : data . visibility ,
135
161
groupId : data . groupId ,
136
162
options : data . options . filter ( option => option . trim ( ) !== "" ) ,
137
- deadline : data . deadline || undefined
163
+ deadline : utcDeadline
138
164
} ) ;
139
165
140
166
toast ( {
@@ -225,7 +251,8 @@ export default function CreatePoll() {
225
251
required
226
252
/>
227
253
< p className = "mt-1 text-sm text-gray-500" >
228
- Set a deadline for when voting will end.
254
+ Set a deadline for when voting will end.
255
+ < span className = "text-blue-600 font-medium" > Note: Times are automatically converted to UTC for accurate backend processing.</ span >
229
256
</ p >
230
257
{ errors . deadline && (
231
258
< p className = "mt-1 text-sm text-red-600" >
0 commit comments