MCPcopy Create free account
hub / github.com/StackStorm/st2 / format_isodate

Function format_isodate

st2client/st2client/utils/date.py:43–61  ·  view source on GitHub ↗

Make a ISO date time string human friendly. :type value: ``str`` :rtype: ``str``

(value, timezone=None)

Source from the content-addressed store, hash-verified

41
42
43def format_isodate(value, timezone=None):
44 """
45 Make a ISO date time string human friendly.
46
47 :type value: ``str``
48
49 :rtype: ``str``
50 """
51 if not value:
52 return ""
53
54 # For some reason pylint thinks it returns a tuple but it returns a datetime object
55 dt = dateutil.parser.parse(str(value))
56
57 if timezone:
58 dt = dt.astimezone(TZ(timezone))
59
60 value = format_dt(dt)
61 return value
62
63
64def format_isodate_for_user_timezone(value):

Callers 2

test_format_isodateMethod · 0.90

Calls 2

format_dtFunction · 0.85
parseMethod · 0.80

Tested by 1

test_format_isodateMethod · 0.72