Модуль:Wikidata: различия между версиями
Перейти к навигации
Перейти к поиску
/>Vlsergey (Новая страница: «Test») |
/>Vlsergey (Новая страница: «Test») |
||
Строка 98: | Строка 98: | ||
local power = powers[ precision + 1 ]; | local power = powers[ precision + 1 ]; | ||
local left = s.year - ( s.year % power ); | local left = s.year - ( s.year % power ); | ||
return tonumber(os.time( {year=left, month=1, day=1, hour=0, min=0, sec=0} )) * 1000, | return { tonumber(os.time( {year=left, month=1, day=1, hour=0, min=0, sec=0} )) * 1000, | ||
tonumber(os.time( {year=left + power - 1, month=12, day=31, hour=29, min=59, sec=59} )) * 1000 + 999; | tonumber(os.time( {year=left + power - 1, month=12, day=31, hour=29, min=59, sec=59} )) * 1000 + 999 }; | ||
end | end | ||
if ( precision == 9 ) then | if ( precision == 9 ) then | ||
return tonumber(os.time( {year=s.year, month=1, day=1, hour=0, min=0, sec=0} )) * 1000, | return { tonumber(os.time( {year=s.year, month=1, day=1, hour=0, min=0, sec=0} )) * 1000, | ||
tonumber(os.time( {year=s.year, month=12, day=31, hour=23, min=59, sec=59} )) * 1000 + 999; | tonumber(os.time( {year=s.year, month=12, day=31, hour=23, min=59, sec=59} )) * 1000 + 999 }; | ||
end | end | ||
Строка 110: | Строка 110: | ||
local lastDays = {31, 28.25, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | local lastDays = {31, 28.25, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | ||
local lastDay = lastDays[s.month]; | local lastDay = lastDays[s.month]; | ||
return tonumber(os.time( {year=s.year, month=s.month, day=1, hour=0, min=0, sec=0} )) * 1000, | return { tonumber(os.time( {year=s.year, month=s.month, day=1, hour=0, min=0, sec=0} )) * 1000, | ||
tonumber(os.time( {year=s.year, month=s.month, day=lastDay, hour=23, min=59, sec=59} )) * 1000 + 999; | tonumber(os.time( {year=s.year, month=s.month, day=lastDay, hour=23, min=59, sec=59} )) * 1000 + 999 }; | ||
end | end | ||
Строка 117: | Строка 117: | ||
local lastDays = {31, 28.25, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | local lastDays = {31, 28.25, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | ||
local lastDay = lastDays[s.month]; | local lastDay = lastDays[s.month]; | ||
return tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=0, min=0, sec=0} )) * 1000, | return { tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=0, min=0, sec=0} )) * 1000, | ||
tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=23, min=59, sec=59} )) * 1000 + 999; | tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=23, min=59, sec=59} )) * 1000 + 999 }; | ||
end | end | ||
if ( precision == 12 ) then | if ( precision == 12 ) then | ||
return tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=0, sec=0} )) * 1000, | return { tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=0, sec=0} )) * 1000, | ||
tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=59, sec=59} )) * 1000 + 999; | tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=59, sec=59} )) * 1000 + 999 }; | ||
end | end | ||
if ( precision == 13 ) then | if ( precision == 13 ) then | ||
return tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=s.min, sec=0} )) * 1000, | return { tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=s.min, sec=0} )) * 1000, | ||
tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=s.min, sec=59} )) * 1000 + 999; | tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=s.min, sec=59} )) * 1000 + 999 }; | ||
end | end | ||
if ( precision == 14 ) then | if ( precision == 14 ) then | ||
local t = tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=s.min, sec=0} ) ); | local t = tonumber(os.time( {year=s.year, month=s.month, day=s.day, hour=s.hour, min=s.min, sec=0} ) ); | ||
return t * 1000, t * 1000 + 999; | return { t * 1000, t * 1000 + 999 }; | ||
end | end | ||