Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Fix creation_date bug #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix creation_date bug #14

wants to merge 1 commit into from

Conversation

MaurizioBruetsch
Copy link

As mentioned in #9 the regex should always be the same whether the task is done or not.
As the other PR wasn't touched for some months I'm hoping you would pull this one.

Thanks

@purarue
Copy link

purarue commented May 15, 2020

Not sure if this PR solves my bug, but in my todo.txt (which odesnt have the (x) to mark to see if the task is done or not), creation dates often dissapear. I've removed that for now, but heres a re-creation of the bug:

import os
import todotxtio

dirname = os.path.dirname(os.path.abspath(__file__))
todo_file: str = os.path.join(dirname, "todo.txt")

todo = todotxtio.Todo(
    text='Thank Guido for such an awesome programming language',
    priority='A',
    creation_date='2016-11-20'
)

print("Todo in memory before write:", todo, sep="\n")

todotxtio.to_file(todo_file, [todo])

print("Todo file contents after first write:", open(todo_file).read(), sep="\n")

todos = todotxtio.from_file(todo_file)

print("Todo in memory after read from written file", todos, sep="\n")

todotxtio.to_file(todo_file, todos)

print("Todo file contents after second write:", open(todo_file).read(), sep="\n")

Output:

Todo in memory before write:
(A) 2016-11-20 Thank Guido for such an awesome programming language
Todo file contents after first write:
(A) 2016-11-20 Thank Guido for such an awesome programming language
Todo in memory after read from written file
[(A) Thank Guido for such an awesome programming language]
Todo file contents after second write:
(A) Thank Guido for such an awesome programming language

When reading/writing back and forth from the todo.txt, the creation dates dissapear -- the regex fails to read the creation date.

purarue added a commit to purarue/full_todotxt that referenced this pull request May 15, 2020
has been a bug with todotxtio for a while
EpocDotFr/todotxtio#14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants