X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fdatetime.lua;h=8e77718d90638c2b03265b8f8e0c43caf01251ef;hb=a80f2d734aaf6cf54728a7d9e4a68335f91af8f9;hp=97dcb8b4eca47a196660e7f08733ce4c67a55127;hpb=7a04d599e21f4fc75cd23488ffa429a4b23c71fa;p=prosody.git diff --git a/util/datetime.lua b/util/datetime.lua index 97dcb8b4..8e77718d 100644 --- a/util/datetime.lua +++ b/util/datetime.lua @@ -7,31 +7,31 @@ -- --- XEP-0082: XMPP Date and Time Profiles - -local os_date = os.date; -local error = error; - -module "datetime" - -function date() - return os_date("!%Y-%m-%d"); -end - -function datetime() - return os_date("!%Y-%m-%dT%H:%M:%SZ"); -end - -function time() - return os_date("!%H:%M:%S"); -end - -function legacy() - return os_date("!%Y%m%dT%H:%M:%S"); -end - -function parse(s) - error("datetime.parse: Not implemented"); -- TODO -end - -return _M; +-- XEP-0082: XMPP Date and Time Profiles + +local os_date = os.date; +local error = error; + +module "datetime" + +function date(t) + return os_date("!%Y-%m-%d", t); +end + +function datetime(t) + return os_date("!%Y-%m-%dT%H:%M:%SZ", t); +end + +function time(t) + return os_date("!%H:%M:%S", t); +end + +function legacy(t) + return os_date("!%Y%m%dT%H:%M:%S", t); +end + +function parse(s) + error("datetime.parse: Not implemented"); -- TODO +end + +return _M;