EpocDotFr / todotxtio

Simple Python module to parse, manipulate and write Todo.txt data
https://epocdotfr.github.io/todotxtio/
Other
15 stars 9 forks source link

Creation dates on tasks with priority are "None" #15

Open TASpinner opened 4 years ago

TASpinner commented 4 years ago

I wrote this up, then noticed @MaurizioBruetsch had a merge request for "Fix creation_date bug #14" Perhaps this is the same issue. Perhaps this has value as a demonstration of the issue.

Using todotxtio 0.2.3

If the todo has a priority assigned and a creation_date, the creation_date is loaded with None.

My code reduced to a simple example:

todo_creation_date_bug.py

#!/usr/bin/python3

todofile = 'todo_creation_date_bug.txt'

import sys
import todotxtio

todos = todotxtio.from_file(todofile)

for todo in todos:
   print(todo, todo.creation_date)

todo_creation_date_bug.txt

(A) 2019-12-31 task with priority, creation date
2019-12-31 task with no priority, creation date
(A) task with priority, no creation date
task with no priority, no creation date

run it

$ ./todo_creation_date_bug.py
(A) task with priority, creation date None
2019-12-31 task with no priority, creation date 2019-12-31
(A) task with priority, no creation date None
task with no priority, no creation date None
$ 

analysis

The first line was: (A) task with priority, creation date None I expected: (A) task with priority, creation date 2019-12-31