ndp.lua

changeset 6
a8bbbfdd12db
parent 5
3eee607e57e8
child 7
7f095ddcfd54
equal deleted inserted replaced
5:3eee607e57e8 6:a8bbbfdd12db
84 time = time + seconds_in_a.day; 84 time = time + seconds_in_a.day;
85 if os.date("%A", time) == day_name then 85 if os.date("%A", time) == day_name then
86 return time; 86 return time;
87 end 87 end
88 end 88 end
89 return;
90 end
91
92 local function find_next_month_by_name(time, month_name)
93 month_name = month_name:lower():gsub("^.", string.upper); -- Normalize
94
95 local split_time = os.date("*t", time);
96 for i=1,13 do
97 split_time.month = split_time.month + 1;
98 if split_time.month == 13 then split_time.month = 1; end
99
100 time = os.time(split_time);
101 if os.date("%B", time) == month_name then
102 return time;
103 end
104 end
89 105
90 return; 106 return;
91 end 107 end
92 108
93 function when(str, relative_to) 109 function when(str, relative_to)

mercurial