Fix incorrect today marker

master
Wuzzy 2020-08-27 02:47:57 +02:00
parent 2a3b345417
commit 037ff86e4f
1 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@ local ORDINAL = false
local function show_calendar(player_name, ordinal, wanted_months, wanted_years)
local days, months, years = calendar.get_date()
local total_days = minetest.get_day_count()
local ddays, dmonths, dyears = calendar.get_date(nil, ordinal)
local wanted_dmonths, wanted_dyears
if not wanted_months then
@ -33,9 +34,9 @@ local function show_calendar(player_name, ordinal, wanted_months, wanted_years)
local weekday = 0
local formspec = "formspec_version[3]size["..(calendar.WEEK_DAYS+2)..",9]"
if ordinal then
formspec = formspec .. "label[0.5,0.5;"..F(S("Month @1, year @2", wanted_dmonths, wanted_dyears)).."]"
formspec = formspec .. "label[0.5,0.5;"..F(S("@1, year @2", calendar.month_names[wanted_months+1], wanted_dyears)).."]"
else
formspec = formspec .. "label[0.5,0.5;"..F(S("@1 months, @2 years", wanted_dmonths, wanted_dyears)).."]"
formspec = formspec .. "label[0.5,0.5;"..F(S("@1, @2 years", calendar.month_names[wanted_months+1], wanted_dyears)).."]"
end
local start_day, end_day
local tdays = 0
@ -68,7 +69,7 @@ local function show_calendar(player_name, ordinal, wanted_months, wanted_years)
table.insert(tooltip_lines, minetest.colorize(COLOR_HOLIDAY, holidays[1].name))
day_str = minetest.colorize(COLOR_HOLIDAY, day_str)
end
if tdays == days then
if tdays == total_days then
box_color = COLOR_DAYBOX_TODAY
table.insert(tooltip_lines, S("Today"))
end