16.01.2019, 13:00
You can get start/end time as Lua table like this. Then you can either convert it to timestamp via os.time() or use it as object value directly.
Code:
function parsedatetime(str)
local date = {}
date.year, date.month, date.day,
date.hour, date.min, date.sec =
str:match('(%d+)%-(%d+)%-(%d+)T(%d+):(%d+):(%d+)')
return date
end
function starttag(p, tag, attrs)
if tag == 'area' and attrs.aac == aac then
in_area = true
elseif tag == 'forecast-period' and in_area then
index = tonumber(attrs.index)
if index then
forecast[ index ] = {
start_time = parsedatetime(attrs['start-time-local']),
end_time = parsedatetime(attrs['end-time-local']),
}
end
elseif index then
prop = attrs.type
end
end
-- start_time = forecast[ 1 ].start_time
-- end_time = forecast[ 1 ].end_time