Code review comment for lp:~gtg-contributors/gtg/new-date-class

Paul Natsuo Kishimoto (khaeru) wrote :

I tried to make Date.parse(...) a replacement for get_canonical_date(...) so that string == str(Date.parse(string)).

The difference between Date.parse and Date.__init__ is that parse() checks a lot more possible formats, while __init__() expects simpler input and also recognizes various objects like datetime. __init__() is more for internal use (hopefully also faster, though I haven't checked...)

To handle more formats (e.g. alien ones belonging to various remote backends), I would extend parse() and keep __init__() as-is.

They are about equivalent, but I think it is easier to add more constants like TODAY, SOON, etc. than to subclass Date. This way, any new fuzzy dates will have to behave in a way that is consistent with the existing ones.

« Back to merge proposal