Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit da5d669

Browse files
author
Samuel Hassine
committed
[client] Fix dates
1 parent cc3d0c8 commit da5d669

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pycti/utils/opencti_stix2.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,10 @@ def extract_embedded_relationships(self, stix_object, types=None) -> dict:
389389
if matches is not None:
390390
try:
391391
for match in matches:
392-
if match.timestamp() < yesterday.timestamp():
392+
if (
393+
match.timestamp() < yesterday.timestamp()
394+
and len(match.year) == 4
395+
):
393396
published = match.strftime("%Y-%m-%dT%H:%M:%SZ")
394397
break
395398
except:
@@ -747,7 +750,10 @@ def import_relationship(self, stix_relation, update=False, types=None):
747750
if matches is not None:
748751
try:
749752
for match in matches:
750-
if match.timestamp() < yesterday.timestamp():
753+
if (
754+
match.timestamp() < yesterday.timestamp()
755+
and len(match.year) == 4
756+
):
751757
date = match.strftime("%Y-%m-%dT%H:%M:%SZ")
752758
break
753759
except:

0 commit comments

Comments
 (0)