@@ -208,22 +208,30 @@ export function formatStartEnd(
208208export function parseTimeInput (
209209 input : string ,
210210 defaultUnit : TimeInputUnit = 'minutes'
211- ) : {
212- seconds : number | null ;
213- isHHMM : boolean ;
214- } {
211+ ) : number | null {
215212 // Check if input is a decimal number (hours)
216213 const decimalRegex = / ^ - ? \d + [ . , ] \d + $ / ;
217214 if ( decimalRegex . test ( input ) ) {
218215 const hours = parseFloat ( input . replace ( ',' , '.' ) ) ;
219- return { seconds : Math . round ( hours * 3600 ) , isHHMM : false } ;
216+ return Math . round ( hours * 3600 ) ;
220217 }
221218
222219 // Check if input is just a number (minutes or hours based on defaultUnit)
223220 if ( / ^ - ? \d + $ / . test ( input ) ) {
224221 const value = parseInt ( input ) ;
225- const seconds = defaultUnit === 'minutes' ? value * 60 : value * 3600 ;
226- return { seconds, isHHMM : false } ;
222+ return defaultUnit === 'minutes' ? value * 60 : value * 3600 ;
223+ }
224+
225+ // Check if input is in HH:MM:SS format
226+ const HHMMSStimeRegex = / ^ ( [ 0 - 9 ] { 1 , 2 } ) : ( [ 0 - 5 ] ? [ 0 - 9 ] ) : ( [ 0 - 5 ] ? [ 0 - 9 ] ) $ / ;
227+ if ( HHMMSStimeRegex . test ( input ) ) {
228+ const match = input . match ( HHMMSStimeRegex ) ;
229+ if ( match ) {
230+ const hours = parseInt ( match [ 1 ] ) ;
231+ const minutes = parseInt ( match [ 2 ] ) ;
232+ const seconds = parseInt ( match [ 3 ] ) ;
233+ return hours * 3600 + minutes * 60 + seconds ;
234+ }
227235 }
228236
229237 // Check if input is in HH:MM format
@@ -233,15 +241,15 @@ export function parseTimeInput(
233241 if ( match ) {
234242 const hours = parseInt ( match [ 1 ] ) ;
235243 const minutes = parseInt ( match [ 2 ] ) ;
236- return { seconds : ( hours * 60 + minutes ) * 60 , isHHMM : true } ;
244+ return ( hours * 60 + minutes ) * 60 ;
237245 }
238246 }
239247
240248 // Try to parse natural language like "1h 30m"
241249 const parsedDuration = parse ( input , 's' ) ;
242250 if ( parsedDuration && parsedDuration > 0 ) {
243- return { seconds : parsedDuration , isHHMM : false } ;
251+ return parsedDuration ;
244252 }
245253
246- return { seconds : null , isHHMM : false } ;
254+ return null ;
247255}
0 commit comments