more human datetimes

This commit is contained in:
Matthias 2021-10-04 22:59:07 +02:00
parent 4dbf87da56
commit c7a077fb33
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -5,6 +5,7 @@ import logging
import os import os
import subprocess import subprocess
import inspect import inspect
from datetime import datetime
from django.conf.urls import url, include from django.conf.urls import url, include
from django.conf import settings from django.conf import settings
@ -301,6 +302,8 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
name = getattr(self, 'PUBLISH_DATE', None) name = getattr(self, 'PUBLISH_DATE', None)
if not name: if not name:
name = self.commit.get('date') name = self.commit.get('date')
else:
name = datetime.fromisoformat(name)
if not name: if not name:
name = _('No date found') name = _('No date found')
return name return name
@ -339,6 +342,10 @@ class IntegrationPluginBase(MixinBase, plugin.InvenTreePlugin):
self.commit = commit self.commit = commit
self.sign_state = sign_state self.sign_state = sign_state
# process date
if self.commit['date']:
self.commit['date'] = datetime.fromisoformat(self.commit['date'])
if sign_state.status == 0: if sign_state.status == 0:
self.sign_color = 'success' self.sign_color = 'success'
elif sign_state.status == 1: elif sign_state.status == 1: