Editing Module:D'ni Time
From Guild of Archivists
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 2: | Line 2: | ||
dnitools = require("Module:D'ni Tools") | dnitools = require("Module:D'ni Tools") | ||
Date = require('Module:Date')._Date | Date = require('Module:Date')._Date | ||
Line 19: | Line 16: | ||
local msPerProrahn = msPerHahr / prorahnteePerHahr | local msPerProrahn = msPerHahr / prorahnteePerHahr | ||
local refProrahnteePerHahr = 9647 * 290 * 5 * 25 * 25 * 25 | local refProrahnteePerHahr = 9647 * 290 * 5 * 25 * 25 * 25 | ||
local vaileetee = {"Leefo","Leebro","Leesahn","Leetar","Leevot","Leevofo","Leevobro","Leevosahn","Leevotar","Leenovoo"} | |||
local vaileetee_dnifont = {"lEfo","lEbro","lEsan","lEtar","lEvot","lEvofo","lEvobro","lEvosan","lEvotar","lEnovU"} | |||
local leapSecTimeStamps = {2272060800, 2287785600, 2303683200, 2335219200, 2366755200, 2398291200, 2429913600, 2461449600, 2492985600, 2524521600, 2571782400, 2603318400, 2634854400, 2698012800, 2776982400, 2840140800, 2871676800, 2918937600, 2950473600, 2982009600, 3029443200, 3076704000, 3124137600, 3345062400, 3439756800, 3550089600, 3644697600, 3692217600} | local leapSecTimeStamps = {2272060800, 2287785600, 2303683200, 2335219200, 2366755200, 2398291200, 2429913600, 2461449600, 2492985600, 2524521600, 2571782400, 2603318400, 2634854400, 2698012800, 2776982400, 2840140800, 2871676800, 2918937600, 2950473600, 2982009600, 3029443200, 3076704000, 3124137600, 3345062400, 3439756800, 3550089600, 3644697600, 3692217600} | ||
Line 196: | Line 196: | ||
return os.date("*t",surfaceTimestamp) | return os.date("*t",surfaceTimestamp) | ||
end | |||
-- ==========Display Functions========= | |||
local function formatSurfaceTime(surfaceTime,format) | |||
format = format or 'c' | |||
lang = mw.getContentLanguage() | |||
-- return lang:formatDate(format,"@"..makeSurfaceTimeStamp(surfaceTime)) | |||
return lang:formatDate(format,tostring(surfaceTime['year'])..'-'..tostring(surfaceTime['month'])..'-'..tostring(surfaceTime['day'])..' '..tostring(surfaceTime['hour'])..':'..tostring(surfaceTime['min'])..':'..tostring(surfaceTime['sec'])) | |||
end | end | ||
Line 221: | Line 234: | ||
preprocessSingleArg('datetime') | preprocessSingleArg('datetime') | ||
preprocessSingleArg('format') | preprocessSingleArg('format') | ||
if args['datetime'] then | if args['datetime'] then | ||
surfaceTime = | surfaceTime = require("Module:D'ni Time/surface").parseSurfaceDateStr(args['datetime']) | ||
output = | output = formatDniTime(surface2DniTime(makeSurfaceTimeStamp(surfaceTime)),args['format']) | ||
else | else | ||
preprocessSingleArg('year') | preprocessSingleArg('year') | ||
Line 235: | Line 247: | ||
-- Parse the data parameters | -- Parse the data parameters | ||
surface = {year = args['year'], month = args['month'] | surface = {year = args['year'], month = args['month'], day = args['day'], hour = args['hour'], min = args['minute'], sec = args['second']} | ||
--- output = | --- output = require("Module:D'ni Time/dni").displayDniTime(surface2DniTime(makeSurfaceTimeStamp(surface)),args['format']) | ||
output = | output = require("Module:D'ni Time/dni").formatDniTime(surface2DniTime(makeSurfaceTimeStamp(surface)),args['format']) | ||
end | end | ||
return output | return output | ||
Line 257: | Line 269: | ||
if args['datetime'] then | if args['datetime'] then | ||
output = | output = formatSurfaceTime(dni2SurfaceTime(require("Module:D'ni Time/dni").parseDniDateStr(args['datetime'],args['input'])),args['format']) | ||
else | else | ||
preprocessSingleArg('hahr') | preprocessSingleArg('hahr') | ||
Line 270: | Line 282: | ||
dni = {hahr = tonumber(args['hahr']), vailee = tonumber(args['vailee']), yahr = tonumber(args['yahr']), gahrtahvo = tonumber(args['gahrtahvo']), tahvo = tonumber(args['tahvo']), gorahn = tonumber(args['gorahn']), prorahn = tonumber(args['prorahn'])} | dni = {hahr = tonumber(args['hahr']), vailee = tonumber(args['vailee']), yahr = tonumber(args['yahr']), gahrtahvo = tonumber(args['gahrtahvo']), tahvo = tonumber(args['tahvo']), gorahn = tonumber(args['gorahn']), prorahn = tonumber(args['prorahn'])} | ||
output = require("Module:D'ni Time/surface").displaySurfaceTime(dni2SurfaceTime(dni),args['format']) | |||
output = | output = output.."<br/>"..formatSurfaceTime(dni2SurfaceTime(dni),args['format']) | ||
end | end | ||
Line 295: | Line 307: | ||
output = "" | output = "" | ||
output = output .. "<br/>".. | output = output .. "<br/>"..require("Module:D'ni Time/surface").displaySurfaceTime(surface) | ||
-- output = output .. "<br/>".. | -- output = output .. "<br/>"..require("Module:D'ni Time/dni").displayDniTime(surface2DniTime(makeSurfaceTimeStamp(surface))) | ||
-- output = output .. "<br/>".. | -- output = output .. "<br/>"..require("Module:D'ni Time/dni").formatDniTime(surface2DniTime(makeSurfaceTimeStamp(surface))) | ||
output = output .. "<br/>".. | output = output .. "<br/>"..require("Module:D'ni Time/dni").displayDniTime(dni) | ||
output = output .. "<br/>".. | output = output .. "<br/>"..require("Module:D'ni Time/surface").displaySurfaceTime(dni2SurfaceTime(dni)) | ||
output = output .. "<br/>"..os.date("ghdd",makeSurfaceTimeStamp(surface)) | output = output .. "<br/>"..os.date("ghdd",makeSurfaceTimeStamp(surface)) | ||
-- output = output .. "<br/>". | -- output = output .. "<br/>"..formatSurfaceTime(surface,args['format']) | ||
-- output = output .. "<br/>"..makeSurfaceTimeStamp(surface) | -- output = output .. "<br/>"..makeSurfaceTimeStamp(surface) | ||
-- output = output .. "<br/>"..lang:formatDate("c","@"..makeSurfaceTimeStamp(surface)) | -- output = output .. "<br/>"..lang:formatDate("c","@"..makeSurfaceTimeStamp(surface)) |