summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0082.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0082.py')
-rw-r--r--sleekxmpp/plugins/xep_0082.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/sleekxmpp/plugins/xep_0082.py b/sleekxmpp/plugins/xep_0082.py
index 96eb331a..02571fa7 100644
--- a/sleekxmpp/plugins/xep_0082.py
+++ b/sleekxmpp/plugins/xep_0082.py
@@ -42,6 +42,7 @@ def format_date(time_obj):
time_obj = time_obj.date()
return time_obj.isoformat()
+
def format_time(time_obj):
"""
Return a formatted string version of a time object.
@@ -60,6 +61,7 @@ def format_time(time_obj):
return '%sZ' % timestamp
return timestamp
+
def format_datetime(time_obj):
"""
Return a formatted string version of a datetime object.
@@ -76,6 +78,7 @@ def format_datetime(time_obj):
return '%sZ' % timestamp
return timestamp
+
def date(year=None, month=None, day=None, obj=False):
"""
Create a date only timestamp for the given instant.
@@ -98,9 +101,10 @@ def date(year=None, month=None, day=None, obj=False):
day = today.day
value = dt.date(year, month, day)
if obj:
- return value
+ return value
return format_date(value)
+
def time(hour=None, min=None, sec=None, micro=None, offset=None, obj=False):
"""
Create a time only timestamp for the given instant.
@@ -136,6 +140,7 @@ def time(hour=None, min=None, sec=None, micro=None, offset=None, obj=False):
return value
return format_time(value)
+
def datetime(year=None, month=None, day=None, hour=None,
min=None, sec=None, micro=None, offset=None,
separators=True, obj=False):
@@ -181,7 +186,7 @@ def datetime(year=None, month=None, day=None, hour=None,
value = dt.datetime(year, month, day, hour,
min, sec, micro, offset)
if obj:
- return value
+ return value
return format_datetime(value)