aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/dataforms.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/dataforms.lua b/util/dataforms.lua
index 25e198df..79559b22 100644
--- a/util/dataforms.lua
+++ b/util/dataforms.lua
@@ -14,6 +14,7 @@ local tostring = tostring;
local t_concat = table.concat;
local st = require "util.stanza";
local jid_prep = require "util.jid".prep;
+local datetime = require "util.datetime";
local _ENV = nil;
-- luacheck: std none
@@ -321,6 +322,13 @@ data_validators["pubsub:integer-or-max"] =
end
end
+data_validators["xs:dateTime"] =
+ function(data, field) -- luacheck: ignore 212/field
+ local n = datetime.parse(data);
+ if not n then return false, "invalid timestamp"; end
+ return true, n;
+ end
+
local function get_form_type(form)
if not st.is_stanza(form) then