MCPcopy
hub / github.com/celery/celery / _datetime_to_json

Function _datetime_to_json

celery/utils/serialization.py:215–230  ·  view source on GitHub ↗
(dt)

Source from the content-addressed store, hash-verified

213
214
215def _datetime_to_json(dt):
216 # See "Date Time String Format" in the ECMA-262 specification.
217 if isinstance(dt, datetime.datetime):
218 r = dt.isoformat()
219 if dt.microsecond:
220 r = r[:23] + r[26:]
221 if r.endswith('+00:00'):
222 r = r[:-6] + 'Z'
223 return r
224 elif isinstance(dt, datetime.time):
225 r = dt.isoformat()
226 if dt.microsecond:
227 r = r[:12]
228 return r
229 else:
230 return dt.isoformat()
231
232
233def jsonify(obj,

Callers 1

jsonifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected