Module:Time/sandbox: Difference between revisions

Content deleted Content added
Looks good
No edit summary
Line 307:
if args[1] then
args[1] = get_full_utc_offset (args[1]):lower(); -- make lower case because tz table member indexes are lower case
-- args[1] = args[1]:lower(); -- make lower case because tz table member indexes are lower case
else
args[1] = 'utc'; -- default to utc
Line 323 ⟶ 322:
args[1] = 'utc_offsets'; -- spoof to show that we recognize this timezone
else
tz = tz_data[args[1]]; and tz_data[tz_data[args[1]].tz] or tz_data[args[1]]; -- make a local copy of the timezone table from tz_data{}
if not is_set(tz) then
return '<span style="font-size:100%" class="error">{{time}} – unknown timezone ([[Template:Time#Error messages|help]])</span>'; -- if the timezone given isn't in module:time/data(/sandbox)
end
if is_set (tz.tz) then -- if tz table has a tz value
tz = tz_data[tz.tz]; -- redo tz table for proper tz abbrev.
end
end
 
local df_vals = {['dmy']=true, ['dmy12']=true, ['dow']=true, ['mdy']=true, ['mdy12']=true, ['iso']=true, ['y']=true, ['12']=true, ['24']=true}; -- TODO: move this table to /data
df = args.df or args[2] or tz.df or 'mdy'; -- template |df= overrides typical df from tz properties TODO: error check these values?
if is_set (df) then
df = df:lower(); -- lower case because we will comparenormalize to lower case values later
if is_setnot (df_vals[df)] then
return '<span style="font-size:100%" class="error">{{time}} – invalid date format ([[Template:Time#Error messages|help]])</span>';
end
 
Line 343 ⟶ 341:
end
 
-- utc_timestamp = os.time(get_test_time (args._TEST_TIME_));
utc_timestamp = os.time(test_time);
else