1
0
mirror of https://github.com/etesync/server synced 2025-07-05 14:52:33 +00:00
etesync-server/django_etebase/admin-cli/management/commands/_utils.py
Martin Michalec e1446646e9 Add admin-cli
2021-06-02 23:29:18 +02:00

15 lines
404 B
Python

from distutils.util import strtobool
from datetime import datetime
import pytz
def argbool(arg):
if arg == None: return None
return bool(strtobool(arg))
def argdate(arg):
if arg == None: return None
try:
return pytz.utc.localize(datetime.strptime(arg, '%Y-%m-%d %H:%M:%S'))
except ValueError:
return pytz.utc.localize(datetime.strptime(arg, '%Y-%m-%d %H:%M:%S.%f'))