From 68bc8aad3cdc1e841345b6818dac5c9deb7b8994 Mon Sep 17 00:00:00 2001 From: Eric Kalosa-Kenyon Date: Sat, 16 Sep 2023 09:56:43 -0400 Subject: [PATCH] fix for imprecise time strings --- src/firebase_functions/private/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/firebase_functions/private/util.py b/src/firebase_functions/private/util.py index 0dd2eaa..b58f86d 100644 --- a/src/firebase_functions/private/util.py +++ b/src/firebase_functions/private/util.py @@ -340,7 +340,10 @@ def nanoseconds_timestamp_conversion(time: str) -> _dt.datetime: def is_precision_timestamp(time: str) -> bool: """Return a bool which indicates if the timestamp is in nanoseconds""" # Split the string into date-time and fraction of second - _, s_fraction = time.split(".") + try: + _, s_fraction = time.split(".") + except ValueError: + return False # If there's no decimal, it's not a nanosecond timestamp. # Split the fraction from the timezone specifier ('Z' or 'z') s_fraction, _ = s_fraction.split(