# cat /usr/www/avm/net/home_auto_hkr_edit.lua
SNIP
newval.timeperiod_overlap("Holiday"..i.."StartDay", "Holiday"..i.."StartMonth", "Holiday"..i.."EndDay", "Holiday"..i.."EndMonth", "SummerStartDay", "SummerStartMonth", "SummerEndDay", "SummerEndMonth", "holiday")
# cat /usr/lua/newval.lua
SNIP
function valfunc.timeperiod_overlap(elem1, elem2, elem3, elem4, elem5, elem6, elem7, elem8)
local tp1_start_day = tonumber(read_value(elem1)) or -1
local tp1_start_month = tonumber(read_value(elem2)) or -1
local tp1_end_day = tonumber(read_value(elem3)) or -1
local tp1_end_month = tonumber(read_value(elem4)) or -1
local tp2_start_day = tonumber(read_value(elem5)) or -1
local tp2_start_month = tonumber(read_value(elem6)) or -1
local tp2_end_day = tonumber(read_value(elem7)) or -1
local tp2_end_month = tonumber(read_value(elem8)) or -1
--SNIP
local curyear = os.date("*t").year
local yday1 = os.date("*t", os.time({day=tp1_start_day, month=tp1_start_month, year=curyear})).yday
local yday2 = os.date("*t", os.time({day=tp1_end_day, month=tp1_end_month, year=curyear})).yday
local sday = os.date("*t", os.time({day=tp2_start_day, month=tp2_start_month, year=curyear})).yday
local eday = os.date("*t", os.time({day=tp2_end_day, month=tp2_end_month, year=curyear})).yday
--
if [COLOR=#0000ff](yday1 < yday2) [/COLOR]
then
if (sday>=yday1) and (sday<=yday2)
then
mark(elem1)
return ret.notdifferent
elseif (eday>=yday1) and (eday<=yday2) then
mark(elem1)
return ret.notdifferent
end
[COLOR=#0000ff]else[/COLOR]
if [COLOR=#0000ff](sday>=yday1)[/COLOR] or (sday<=yday2)
[COLOR=#0000ff] then
mark(elem1)
return ret.notdifferent[/COLOR]
elseif (eday>=yday1) or (eday<=yday2) then
mark(elem1)
return ret.notdifferent
end
end