mirror of
https://github.com/TangentFoxy/lua-date.git
synced 2025-07-28 02:52:18 +00:00
Upload version 2.0
This commit is contained in:
@@ -32,7 +32,7 @@ local htm_head = [[
|
||||
td {vertical-align: middle; text-align:center;}
|
||||
td.sun {color: red;}
|
||||
td.sat {color: blue;}
|
||||
</style>
|
||||
</style>
|
||||
<html>
|
||||
]]
|
||||
local htm_yearhead = '\n<table align="left">'
|
||||
@@ -40,7 +40,7 @@ local htm_monhead = '\n<tr><th colspan = "7">%s, %s</th></tr><tr><td>sun</td><t
|
||||
local htm_monweek = '\n<tr><td class="sun">%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class="sat">%s</td></tr>'
|
||||
local htm_yearfoot = '\n</table>'
|
||||
function makecalendar(y, iox)
|
||||
iox:write(htm_yearhead)
|
||||
iox:write(htm_yearhead)
|
||||
for i = 1, 12 do
|
||||
local tm = makemonth(y, i)
|
||||
iox:write(string.format(htm_monhead, tm.name, tm.year))
|
||||
@@ -49,7 +49,7 @@ function makecalendar(y, iox)
|
||||
end
|
||||
end
|
||||
iox:write(htm_yearfoot)
|
||||
|
||||
|
||||
end
|
||||
|
||||
io.stdout:write(htm_head)
|
||||
|
@@ -1,23 +0,0 @@
|
||||
require 'date'
|
||||
|
||||
d1 = date('July 4 2009')
|
||||
assert(d1:getmonth() == 7)
|
||||
d2 = d1:copy()
|
||||
d2:adddays(2)
|
||||
diff = d2 - d1
|
||||
assert(diff:spandays() == 2)
|
||||
assert(diff:spanhours() == 48)
|
||||
|
||||
assert(date 'July 4 2009' == date '2009-07-04')
|
||||
|
||||
a = date(1970, 1, 1)
|
||||
y, m, d = a:getdate()
|
||||
assert(y == 1970 and m == 1 and d == 1)
|
||||
|
||||
d = date(1966, 'sep', 6)
|
||||
assert(d:getday() == 6)
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user