| Total Complexity | 4 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from datetime import datetime |
||
| 2 | |||
| 3 | from flask_babel import format_datetime, format_timedelta |
||
| 4 | |||
| 5 | |||
| 6 | def format_datetime_custom(value): |
||
| 7 | if value is None: |
||
| 8 | return 'Not yet' |
||
| 9 | return format_datetime(value, 'dd.MM.yy HH:mm') |
||
| 10 | |||
| 11 | |||
| 12 | def format_timedelta_custom(value): |
||
| 13 | if value is None: |
||
| 14 | return 'Not yet' |
||
| 15 | now = datetime.utcnow() |
||
| 16 | return format_timedelta(value - now, granularity='day', add_direction=True) |
||
| 17 |