chaoswg.helpers   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 12
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A format_datetime_custom() 0 4 2
A format_timedelta_custom() 0 5 2
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