Show date in tag
This commit is contained in:
parent
c7903ef4b5
commit
2691df360f
|
|
@ -1,5 +1,5 @@
|
|||
from datetime import datetime
|
||||
|
||||
from typing import Optional
|
||||
|
||||
def format_month(month: int) -> str:
|
||||
if month == 1:
|
||||
|
|
@ -32,3 +32,10 @@ def format_month(month: int) -> str:
|
|||
|
||||
def format(date: datetime) -> str:
|
||||
return f'{date.day} {format_month(date.month)} {date.year} à {date.hour:02}h{date.minute:02}'
|
||||
|
||||
|
||||
def format_short(date: Optional[datetime]) -> str:
|
||||
if date is None:
|
||||
return 'XX/XX/XXXX'
|
||||
|
||||
return f'{date.day:02}/{date.month:02}/{date.year}'
|
||||
|
|
|
|||
3
db.py
3
db.py
|
|
@ -118,6 +118,9 @@ class Calibration:
|
|||
def get_pretty_date(self) -> str:
|
||||
return dateutils.format(self.validated_date)
|
||||
|
||||
def get_pretty_short_date(self) -> str:
|
||||
return dateutils.format_short(self.validated_date)
|
||||
|
||||
|
||||
Calibration.Dummy = Calibration(-1, CalibrationState.Empty, None)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
<a id="calibration-tag-3" class="calibration-tag navbar-item" href="/calibrate" {% if calibration.state != 3 %}style="display: none;"{% endif %}>
|
||||
<span class="tags has-addons">
|
||||
<span class="tag is-dark">étalonnage</span>
|
||||
<span class="tag is-success">validé</span>
|
||||
<span class="tag is-success">validé le {{ calibration.get_pretty_short_date() }}</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue