Software /
code /
prosody
Diff
util/dataforms.lua @ 11878:bf6706057283
util.dataforms: Turn number values into timestamps for datetime fields
Makes it symmetric with parsing.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 26 Oct 2021 15:17:49 +0200 |
parent | 11877:593b141ba01c |
child | 11880:d30c81b875f2 |
line wrap: on
line diff
--- a/util/dataforms.lua Tue Oct 26 15:15:57 2021 +0200 +++ b/util/dataforms.lua Tue Oct 26 15:17:49 2021 +0200 @@ -103,7 +103,9 @@ if value ~= nil then if type(value) == "number" then - if field_type == "boolean" then + if field.datatype == "xs:dateTime" then + value = datetime.datetime(value); + elseif field_type == "boolean" then value = value ~= 0; else value = ("%g"):format(value);