Skip to content

Commit f463ed1

Browse files
authored
fix: precision timestamp detection issue (#137)
1 parent 51362fb commit f463ed1

File tree

1 file changed

+4
-1
lines changed
  • src/firebase_functions/private

1 file changed

+4
-1
lines changed

src/firebase_functions/private/util.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ def nanoseconds_timestamp_conversion(time: str) -> _dt.datetime:
340340
def is_precision_timestamp(time: str) -> bool:
341341
"""Return a bool which indicates if the timestamp is in nanoseconds"""
342342
# Split the string into date-time and fraction of second
343-
_, s_fraction = time.split(".")
343+
try:
344+
_, s_fraction = time.split(".")
345+
except ValueError:
346+
return False # If there's no decimal, it's not a nanosecond timestamp.
344347

345348
# Split the fraction from the timezone specifier ('Z' or 'z')
346349
s_fraction, _ = s_fraction.split(

0 commit comments

Comments
 (0)