Allow to specify 'in the morning' to refer to tomorrow

Sun, 21 Jun 2009 22:56:59 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 21 Jun 2009 22:56:59 +0100
changeset 15
9c9e64488e54
parent 14
f5bbdcb5b148
child 16
35fb87e8289c

Allow to specify 'in the morning' to refer to tomorrow

ndp.lua file | annotate | diff | comparison | revisions
--- a/ndp.lua	Sun Jun 21 22:56:09 2009 +0100
+++ b/ndp.lua	Sun Jun 21 22:56:59 2009 +0100
@@ -149,6 +149,11 @@
 		{ lpeg.one_of{"this ", "in the ", "at "} * time_of_day /
 			function (time_of_day)
 					time_of_day = time_of_day:match("%S+$");
+
+					if time_of_day == "morning" and get_time_part(time, "hour") > time_of_days.morning then
+						time = time + seconds_in_a.day; -- Morning has passed, so next morning
+					end
+
 					time = adjust_time(time, "hour", time_of_days[time_of_day]);
 					if time_of_day == "noon" or time_of_day == "midnight" then
 						time = adjust_time(time, "min", 00);						

mercurial