<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alsresume.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ATwitterSnowflake</id>
	<title>Module:TwitterSnowflake - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alsresume.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ATwitterSnowflake"/>
	<link rel="alternate" type="text/html" href="https://wiki.alsresume.com/index.php?title=Module:TwitterSnowflake&amp;action=history"/>
	<updated>2026-04-04T19:43:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.0</generator>
	<entry>
		<id>https://wiki.alsresume.com/index.php?title=Module:TwitterSnowflake&amp;diff=27738&amp;oldid=prev</id>
		<title>Admin: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.alsresume.com/index.php?title=Module:TwitterSnowflake&amp;diff=27738&amp;oldid=prev"/>
		<updated>2025-04-11T05:46:24Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:46, 10 April 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://wiki.alsresume.com/index.php?title=Module:TwitterSnowflake&amp;diff=27737&amp;oldid=prev</id>
		<title>wikipedia&gt;Pppery: Fix a Lua error appearing on pages such as August 11 when there&#039;s no date</title>
		<link rel="alternate" type="text/html" href="https://wiki.alsresume.com/index.php?title=Module:TwitterSnowflake&amp;diff=27737&amp;oldid=prev"/>
		<updated>2023-01-24T23:20:20Z</updated>

		<summary type="html">&lt;p&gt;Fix a Lua error appearing on pages such as &lt;a href=&quot;/index.php?title=August_11&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;August 11 (page does not exist)&quot;&gt;August 11&lt;/a&gt; when there&amp;#039;s no date&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local Date = require(&amp;#039;Module:Date&amp;#039;)._Date&lt;br /&gt;
&lt;br /&gt;
function p.snowflakeToDate(frame)&lt;br /&gt;
	local format = frame.args.format or &amp;quot;%B %e, %Y&amp;quot;&lt;br /&gt;
	local epoch = tonumber(frame.args.epoch) or 1288834974&lt;br /&gt;
	local id_str = frame.args.id_str&lt;br /&gt;
	if type(id_str) ~= &amp;quot;string&amp;quot; then error(&amp;quot;bad argument #1 (expected string, got &amp;quot; .. type(id_str) .. &amp;quot;)&amp;quot;, 2) end&lt;br /&gt;
	if type(format) ~= &amp;quot;string&amp;quot; then error(&amp;quot;bad argument #2 (expected string, got &amp;quot; .. type(format) .. &amp;quot;)&amp;quot;, 2) end&lt;br /&gt;
	if type(epoch) ~= &amp;quot;number&amp;quot; then error(&amp;quot;bad argument #3 (expected number, got &amp;quot; .. type(epoch) .. &amp;quot;)&amp;quot;, 2) end&lt;br /&gt;
	local hi, lo = 0, 0&lt;br /&gt;
	local hiexp = 1&lt;br /&gt;
	local two32 = 2^32&lt;br /&gt;
	for c in id_str:gmatch(&amp;quot;.&amp;quot;) do&lt;br /&gt;
		lo = lo * 10 + c&lt;br /&gt;
		if lo &amp;gt;= two32 then&lt;br /&gt;
			hi, lo = hi * 10^hiexp + math.floor(lo / two32), lo % two32&lt;br /&gt;
			hiexp = 1&lt;br /&gt;
		else hiexp = hiexp + 1 end&lt;br /&gt;
	end&lt;br /&gt;
	hi = hi * 10^(hiexp-1)&lt;br /&gt;
	local timestamp = math.floor((hi * 1024 + math.floor(lo / 4194304)) / 1000) + epoch&lt;br /&gt;
	return os.date(format, timestamp)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getDate(frame)&lt;br /&gt;
	-- just pass frame directly to snowflakeToDate, this wraps it but the args are the same plus&lt;br /&gt;
	if (frame.args.id_str):match(&amp;quot;%D&amp;quot;) then -- not a number, so return -2&lt;br /&gt;
		return -2&lt;br /&gt;
	end&lt;br /&gt;
	frame.args.format = &amp;quot;%B %e, %Y&amp;quot;&lt;br /&gt;
	if frame.args.date then &lt;br /&gt;
		frame.args.date = mw.ustring.gsub(frame.args.date, &amp;quot;(%d%d%d%d)%a&amp;quot;, &amp;quot;%1&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	frame.args.epoch = tonumber(frame.args.epoch) or 1288834974&lt;br /&gt;
	local epochdate = Date(os.date(&amp;quot;%B %e, %Y&amp;quot;, frame.args.epoch))&lt;br /&gt;
	local twitterdate = Date(p.snowflakeToDate(frame))&lt;br /&gt;
	if twitterdate == epochdate then -- created before epoch, so can&amp;#039;t determine the date&lt;br /&gt;
		return -1&lt;br /&gt;
	end&lt;br /&gt;
	local date = Date(frame.args.date) or 0 -- if we error here, then an input of no date causes an error, which is contrary to the entire way {{TwitterSnowflake/datecheck}} works&lt;br /&gt;
	return date - twitterdate&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function abs_datediff(x)&lt;br /&gt;
	if type(x) == &amp;#039;number&amp;#039; then return math.abs(x) end&lt;br /&gt;
	return math.abs(x.age_days)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.datecheck(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	if not (args.date and args.id_str) then&lt;br /&gt;
		error(&amp;#039;Must define date and id_str, even if they are blank.&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	local errors = {&lt;br /&gt;
		args.error1 or &amp;#039;Date mismatch of two or more days&amp;#039;,&lt;br /&gt;
		args.error2 or &amp;#039;No date, and posted before November 4, 2010&amp;#039;,&lt;br /&gt;
		args.error3 or &amp;#039;Invalid id_str&amp;#039;&lt;br /&gt;
	}&lt;br /&gt;
	if mw.title.getCurrentTitle():inNamespace(0) and args.error_cat then&lt;br /&gt;
		for i = 1, 3 do errors[i] = errors[i] .. &amp;#039;[[&amp;#039; .. args.error_cat .. &amp;#039;]]&amp;#039; end&lt;br /&gt;
	end&lt;br /&gt;
	if not args.date:match(&amp;#039;^%s*$&amp;#039;) then -- #if:{{{date|}}}&lt;br /&gt;
		local testResult = p.getDate{ args = { date = args.date, id_str = args.id_str }}&lt;br /&gt;
		if testResult == -2 then return errors[3] end&lt;br /&gt;
		if abs_datediff(testResult) &amp;gt; 1 then return errors[1] end&lt;br /&gt;
	elseif not args.id_str:match(&amp;#039;^%s*$&amp;#039;) then&lt;br /&gt;
		local testResult = p.getDate{ args = { id_str = args.id_str }}&lt;br /&gt;
		if testResult == -1 then return errors[2] end&lt;br /&gt;
		if testResult == -2 then return errors[3] end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>wikipedia&gt;Pppery</name></author>
	</entry>
</feed>