Add timezone offset setting

Clarify timezone offset tooltip

Co-authored-by: y5nw <37980625+y5nw@users.noreply.github.com>
This commit is contained in:
Athozus 2024-04-14 15:46:23 +02:00
parent 9a52c1c181
commit 1dab26f0bf
2 changed files with 6 additions and 1 deletions

View File

@ -58,7 +58,8 @@ function mail.show_message(name, id)
local cc = minetest.formspec_escape(message.cc) or ""
if string.len(cc) > 50 then cc = string.sub(cc, 1, 47) .. "..." end
local date = type(message.time) == "number"
and minetest.formspec_escape(os.date(mail.get_setting(name, "date_format"), message.time)) or ""
and minetest.formspec_escape(os.date(mail.get_setting(name, "date_format"),
message.time+3600*mail.get_setting(name, "timezone_offset"))) or ""
local subject = minetest.formspec_escape(message.subject) or ""
local body = minetest.formspec_escape(message.body) or ""
formspec = string.format(formspec, from, to, cc, date, subject, body)

View File

@ -45,6 +45,10 @@ mail.settings = {
type = "string", default = "%Y-%m-%d %X", group = "other", index = 3, label = S("Date format"),
dataset = {"%Y-%m-%d %X", "%d/%m/%y %X", "%A %d %B %Y %X"}, format = os.date
},
timezone_offset = {
type = "number", default = 0, group = "other", index = 4,
label = S("Timezone offset"), tooltip = S("Offset to add to server time."),
},
mute_list = {
type = "list", default = {}, group = "spam", index = 1,
label = S("Mute list")