mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
Fix handling of little-endian date format
Ever since version 2.0, when parsing a journal file, jrnl would not use the custom date format string anymore. Instead, it relied on the dateutil library to get the parsing right. This change was made to allow people to change their date format without having to manually change their file. However, this broke some existing date formats like %d.%m.%Y, as it would falsely interpret the month as day and vice versa. This commit adds some tests to catch this error and fixes it by trying to parse the dates using the custom format first, only falling back to dateutil when needed.
This commit is contained in:
parent
9d8d6a83ae
commit
7f46d1a40a
7 changed files with 92 additions and 1 deletions
12
features/data/configs/little_endian_dates.yaml
Normal file
12
features/data/configs/little_endian_dates.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
default_hour: 9
|
||||
default_minute: 0
|
||||
editor: ""
|
||||
encrypt: false
|
||||
highlight: true
|
||||
journals:
|
||||
default: features/journals/little_endian_dates.journal
|
||||
linewrap: 80
|
||||
tagsymbols: "@"
|
||||
template: false
|
||||
timeformat: "%d.%m.%Y %H:%M"
|
||||
indent_character: "|"
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"default_hour": 9,
|
||||
"timeformat": "%d.%m.%Y %H:%M",
|
||||
"linewrap": 80,
|
||||
"encrypt": false,
|
||||
"editor": "",
|
||||
"default_minute": 0,
|
||||
"highlight": true,
|
||||
"journals": {"default": "features/journals/simple_jrnl-1-9-5_little_endian_dates.journal"},
|
||||
"tagsymbols": "@"
|
||||
}
|
5
features/data/journals/little_endian_dates.journal
Normal file
5
features/data/journals/little_endian_dates.journal
Normal file
|
@ -0,0 +1,5 @@
|
|||
[09.06.2013 15:39] My first entry.
|
||||
Everything is alright
|
||||
|
||||
[10.06.2013 15:40] Life is good.
|
||||
But I'm better.
|
|
@ -0,0 +1,13 @@
|
|||
10.06.2010 15:00 A life without chocolate is like a bad analogy.
|
||||
|
||||
10.06.2013 15:40 He said "[this] is the best time to be alive".
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
|
||||
quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque
|
||||
augue et venenatis facilisis.
|
||||
|
||||
[03.08.2019 12:55] Some chat log or something
|
||||
|
||||
Suspendisse potenti. Sed dignissim sed nisl eu consequat. Aenean ante ex,
|
||||
elementum ut interdum et, mattis eget lacus. In commodo nulla nec tellus
|
||||
placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at dolor
|
||||
dui.
|
Loading…
Add table
Add a link
Reference in a new issue