Use strict date matching, if using the default time format

This commit is contained in:
Lenahan Michael 2020-09-10 21:01:34 +02:00
parent 12e01656f0
commit 851f8ef0c6

View file

@ -128,6 +128,11 @@ class Journal:
entries = []
date_blob_re = re.compile("(?:^|\n)\\[([^\\]]+)\\] ")
# Use strict date matching, if using the default time format
if self.config["timeformat"] == '%Y-%m-%d %H:%M':
date_blob_re = re.compile("(?:^|\n)\\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2})\\] ")
last_entry_pos = 0
for match in date_blob_re.finditer(journal_txt):
date_blob = match.groups()[0]