Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions seatable_api/date_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ def between(cls, start, end, include_last=False):

class DateUtils(object):

@classmethod
def utcnow(cls):
now = datetime.datetime.now()
utc_timezone = datetime.timezone.utc
isoformat_timestr = now.astimezone(utc_timezone).isoformat()
return isoformat_timestr

def _isoformat(self, d, format_str="%Y-%m-%d"):
if not isinstance(d, (datetime.date, datetime.datetime)):
raise ValueError('datetime type error')
Expand Down
7 changes: 5 additions & 2 deletions seatable_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .socket_io import SocketIO
from .query import QuerySet
from .utils import convert_db_rows
from .date_utils import dateutils


def parse_headers(token):
Expand Down Expand Up @@ -1005,7 +1006,8 @@ def upload_bytes_file(self, name, content: bytes, relative_path=None, file_type=
'type': file_type,
'size': d.get('size'),
'name': d.get('name'),
'url': url
'url': url,
'upload_time': dateutils.utcnow()
}

@check_auth
Expand Down Expand Up @@ -1050,7 +1052,8 @@ def upload_local_file(self, file_path, name=None, relative_path=None, file_type=
'type': file_type,
'size': d.get('size'),
'name': d.get('name'),
'url': url
'url': url,
'upload_time': dateutils.utcnow()
}

@check_auth
Expand Down