aboutsummaryrefslogtreecommitdiffstats
path: root/util/datetime.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/datetime.lua')
-rw-r--r--util/datetime.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/util/datetime.lua b/util/datetime.lua
new file mode 100644
index 00000000..077cbb67
--- /dev/null
+++ b/util/datetime.lua
@@ -0,0 +1,28 @@
+-- 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;