1.1 --- a/imiptools/dates.py Thu Jan 29 20:34:56 2015 +0100
1.2 +++ b/imiptools/dates.py Thu Jan 29 22:55:29 2015 +0100
1.3 @@ -19,7 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from datetime import date, datetime
1.8 +from datetime import date, datetime, timedelta
1.9 from pytz import timezone, UnknownTimeZoneError
1.10 import re
1.11
1.12 @@ -101,4 +101,13 @@
1.13 def get_start_of_day(dt):
1.14 return datetime(dt.year, dt.month, dt.day, 0, 0, tzinfo=dt.tzinfo)
1.15
1.16 +def get_end_of_day(dt):
1.17 + return get_start_of_day(dt + timedelta(1))
1.18 +
1.19 +def ends_on_same_day(dt, end):
1.20 + return (
1.21 + dt.date() == end.date() or
1.22 + end == get_end_of_day(dt)
1.23 + )
1.24 +
1.25 # vim: tabstop=4 expandtab shiftwidth=4