summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rem.lua62
1 files changed, 21 insertions, 41 deletions
diff --git a/rem.lua b/rem.lua
index 1c0887a..3dd1aeb 100644
--- a/rem.lua
+++ b/rem.lua
@@ -79,47 +79,12 @@ local get_param_value_1 = function (params, name)
return nil
end
-local rem_of_vcalendars do
-
- local f_sec = 1
- local f_min = 60 * f_sec
- local f_hour = 60 * f_min
- local f_day = 24 * f_hour
- local l_month = { [00] = 0
- , [01] = 31
- , [02] = 30
- , [03] = 31
- , [04] = 30
- , [05] = 31
- , [06] = 30
- , [07] = 31
- , [08] = 31
- , [09] = 30
- , [10] = 31
- , [11] = 30
- , [12] = 31
- }
-
- local time_of_month = function (m, y)
- local r = 0
-
- for i = 0, m - 1 do
- local f = l_month [i]
-
- if i == 2 and y % 4 == 0 and y % 100 ~= 0 then
- f = f + 1
- end
-
- r = r + f * f_day
- end
+local time_f_sec = 1
+local time_f_min = 60 * time_f_sec
+local time_f_hour = 60 * time_f_min
+local time_f_day = 24 * time_f_hour
- return r
- end
-
- local time_of_year = function (y)
- if y % 4 == 0 and y % 100 ~= 0 then
- end
- end
+local rem_of_vcalendars do
--[[--
@@ -231,11 +196,26 @@ local rem_of_vcalendars do
return stringformat ("%0.2d:%s", dt, ret)
end
+ local repeat_of_duration = function (te)
+ local till = rem_date (te)
+
+ return stringformat ("*1 UNTIL %s", till)
+ end
+
+
local rem_date_duration = function (t0, te, loctime)
local dt = te - t0
local s_t0 = rem_date (t0, loctime)
- if dt == 0 then return s_t0 end
+ if dt == 0 or dt == time_f_day then
+ return s_t0
+ end
+
+ if dt > time_f_day then --- needs repeat claus
+ local rep = repeat_of_duration (te)
+
+ return stringformat ("%s %s", s_t0, rep)
+ end
local s_dt = rem_duration (dt)