-
-
Notifications
You must be signed in to change notification settings - Fork 525
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#696] supporting little-endian date format (e.g. DD/MM/YYYY)
Fix parsing Journals using a little-endian date format
- Loading branch information
Showing
7 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Feature: Reading and writing to journal with custom date formats | ||
|
||
Scenario: Loading a sample journal | ||
Given we use the config "little_endian_dates.yaml" | ||
When we run "jrnl -n 2" | ||
Then we should get no error | ||
And the output should be | ||
""" | ||
09.06.2013 15:39 My first entry. | ||
| Everything is alright | ||
10.06.2013 15:40 Life is good. | ||
| But I'm better. | ||
""" | ||
|
||
Scenario: Writing an entry from command line | ||
Given we use the config "little_endian_dates.yaml" | ||
When we run "jrnl 2013-07-12: A cold and stormy day. I ate crisps on the sofa." | ||
Then we should see the message "Entry added" | ||
When we run "jrnl -n 1" | ||
Then the output should contain "12.07.2013 09:00 A cold and stormy day." | ||
|
||
Scenario: Filtering for dates | ||
Given we use the config "little_endian_dates.yaml" | ||
When we run "jrnl -on 2013-06-10 --short" | ||
Then the output should be "10.06.2013 15:40 Life is good." | ||
When we run "jrnl -on 'june 6 2013' --short" | ||
Then the output should be "10.06.2013 15:40 Life is good." | ||
|
||
Scenario: Writing an entry at the prompt | ||
Given we use the config "little_endian_dates.yaml" | ||
When we run "jrnl" and enter "2013-05-10: I saw Elvis. He's alive." | ||
Then we should get no error | ||
And the journal should contain "[10.05.2013 09:00] I saw Elvis." | ||
And the journal should contain "He's alive." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: "|" |
11 changes: 11 additions & 0 deletions
11
features/data/configs/upgrade_from_195_little_endian_dates.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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": "@" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
13 changes: 13 additions & 0 deletions
13
features/data/journals/simple_jrnl-1-9-5_little_endian_dates.journal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters