Skip to content

Commit

Permalink
deposit: fix log date format
Browse files Browse the repository at this point in the history
* Fixes date format to UTC timezone for deposit logs.
* Closes #333.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
  • Loading branch information
Sébastien Délèze committed Oct 21, 2020
1 parent 7d13f64 commit a19021f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion sonar/modules/deposits/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from datetime import datetime
from functools import partial

import pytz

from sonar.modules.documents.api import DocumentRecord
from sonar.modules.users.api import current_user_record

Expand Down Expand Up @@ -84,7 +86,7 @@ def log_action(self, user, action, comment=None):

log = {
'user': user,
'date': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
'date': pytz.utc.localize(datetime.utcnow()).isoformat(),
'action': action
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
"type": "keyword"
},
"date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
"type": "date"
},
"comment": {
"type": "text"
Expand Down

0 comments on commit a19021f

Please # to comment.