mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Make one method for comma-formatting numbers
We were doing this a few different ways in different places.
This commit is contained in:
@@ -3,6 +3,7 @@ import os
|
||||
import urllib
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from functools import partial
|
||||
from numbers import Number
|
||||
from time import monotonic
|
||||
|
||||
import ago
|
||||
@@ -345,8 +346,12 @@ def format_delta(date):
|
||||
)
|
||||
|
||||
|
||||
def format_thousands(number):
|
||||
return "{:,.0f}".format(number)
|
||||
def format_thousands(value):
|
||||
if isinstance(value, Number):
|
||||
return '{:,.0f}'.format(value)
|
||||
if value is None:
|
||||
return ''
|
||||
return value
|
||||
|
||||
|
||||
def valid_phone_number(phone_number):
|
||||
|
||||
Reference in New Issue
Block a user