Skip to content

Commit 4f3a4cc

Browse files
committed
utils: try converting str time to float before checking if unix timestamps
1 parent bec6133 commit 4f3a4cc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

slips_files/common/slips_utils.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,17 @@ def convert_to_datetime(self, ts):
449449
)
450450

451451
def is_unix_ts(self, time) -> bool:
452-
return isinstance(time, (int, float))
452+
if isinstance(time, (int, float)):
453+
return True
454+
455+
if isinstance(time, str):
456+
try:
457+
float(time)
458+
return True
459+
except ValueError:
460+
pass
461+
462+
return False
453463

454464
def get_time_format(self, time) -> Optional[str]:
455465
if self.is_datetime_obj(time):

0 commit comments

Comments
 (0)