Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
d22c4bc7
Commit
d22c4bc7
authored
Nov 26, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'yesterday' as a relative date
parent
6bb804dc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
test/test_relative_date.py
test/test_relative_date.py
+9
-0
topydo/lib/RelativeDate.py
topydo/lib/RelativeDate.py
+4
-1
No files found.
test/test_relative_date.py
View file @
d22c4bc7
...
...
@@ -26,6 +26,7 @@ from topydo.lib.RelativeDate import relative_date_to_date
class
RelativeDateTester
(
TopydoTest
):
def
setUp
(
self
):
super
(
RelativeDateTester
,
self
).
setUp
()
self
.
yesterday
=
date
(
2015
,
11
,
5
)
self
.
today
=
date
(
2015
,
11
,
6
)
self
.
tomorrow
=
date
(
2015
,
11
,
7
)
self
.
monday
=
date
(
2015
,
11
,
9
)
...
...
@@ -115,6 +116,14 @@ class RelativeDateTester(TopydoTest):
result
=
relative_date_to_date
(
'tom'
)
self
.
assertEqual
(
result
,
self
.
tomorrow
)
def
test_yesterday1
(
self
):
result
=
relative_date_to_date
(
'yesterday'
)
self
.
assertEqual
(
result
,
self
.
yesterday
)
def
test_yesterday2
(
self
):
result
=
relative_date_to_date
(
'yes'
)
self
.
assertEqual
(
result
,
self
.
yesterday
)
def
test_monday1
(
self
):
result
=
relative_date_to_date
(
'monday'
)
self
.
assertEqual
(
result
,
self
.
monday
)
...
...
topydo/lib/RelativeDate.py
View file @
d22c4bc7
...
...
@@ -91,7 +91,7 @@ def relative_date_to_date(p_date, p_offset=None):
The following formats are understood:
* [0-9][dwmy]
* 'today' or 'tomorrow'
* '
yesterday', '
today' or 'tomorrow'
* days of the week (in full or abbreviated)
"""
result
=
None
...
...
@@ -126,4 +126,7 @@ def relative_date_to_date(p_date, p_offset=None):
elif
re
.
match
(
'tom(orrow)?$'
,
p_date
):
result
=
_convert_pattern
(
'1'
,
'd'
)
elif
re
.
match
(
'yes(terday)?$'
,
p_date
):
result
=
_convert_pattern
(
'-1'
,
'd'
)
return
result
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment