@@ -329,20 +329,23 @@ def duration(seconds) -> str:
329329 if seconds is None or math .isnan (seconds ) or seconds == 0 :
330330 return ""
331331
332- test = humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "minutes" , format = "%0.0f" )
332+ try :
333+ test = humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "minutes" , format = "%0.0f" )
333334
334- PRECISION_YEARS = 3
335- if len (test .split ("," )) >= PRECISION_YEARS :
336- return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "hours" , format = "%0.0f" )
335+ PRECISION_YEARS = 3
336+ if len (test .split ("," )) >= PRECISION_YEARS :
337+ return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "hours" , format = "%0.0f" )
337338
338- PRECISION_MONTHS = 2
339- if len (test .split ("," )) >= PRECISION_MONTHS :
340- return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "hours" , format = "%0.0f" )
339+ PRECISION_MONTHS = 2
340+ if len (test .split ("," )) >= PRECISION_MONTHS :
341+ return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "hours" , format = "%0.0f" )
341342
342- if int (seconds ) > 10 * 60 :
343- return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "minutes" , format = "%0.0f" )
343+ if int (seconds ) > 10 * 60 :
344+ return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "minutes" , format = "%0.0f" )
344345
345- return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "seconds" , format = "%0.0f" )
346+ return humanize .precisedelta (timedelta (seconds = int (seconds )), minimum_unit = "seconds" , format = "%0.0f" )
347+ except OverflowError :
348+ return ""
346349
347350
348351def relative_datetime (seconds ) -> str :
0 commit comments