20 lines
329 B
Python
20 lines
329 B
Python
import json
|
|
|
|
|
|
def format_currency(x):
|
|
# It would be nicer to format this using the German locale
|
|
# Too lazy to bother tho.
|
|
return f"{x:.02f}€".replace(".", ",")
|
|
|
|
|
|
def format_date(d):
|
|
return d.strftime("%Y-%m-%d")
|
|
|
|
|
|
def format_bool(x):
|
|
return "✅" if x else "❌"
|
|
|
|
|
|
def to_json(x):
|
|
return json.dumps(x)
|