Jelajahi Sumber

Simplified datetime parser

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen 4 tahun lalu
induk
melakukan
f8f7ce43a0
1 mengubah file dengan 1 tambahan dan 4 penghapusan
  1. 1 4
      openleadr/utils.py

+ 1 - 4
openleadr/utils.py

@@ -261,10 +261,7 @@ def parse_datetime(value):
         if micro is None:
             micro = 0
         else:
-            if len(micro) == 6:
-                micro = int(micro)
-            else:
-                micro = int(micro + "0" * (6 - len(micro)))
+            micro = int(micro + "0" * (6 - len(micro)))
         return datetime(year, month, day, hour, minute, second, micro, tzinfo=timezone.utc)
     else:
         logger.warning(f"parse_datetime: {value} did not match format")