Pārlūkot izejas kodu

Simplified datetime parser

Signed-off-by: Stan Janssen <stan.janssen@elaad.nl>
Stan Janssen 4 gadi atpakaļ
vecāks
revīzija
f8f7ce43a0
1 mainītis faili ar 1 papildinājumiem un 4 dzēšanām
  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")