biweeklybudget.utils module


Given an integer day of month (1 <= n <= 31), return that number with the appropriate suffix (st|nd|rd|th).


Parameters:n (int) – Integer day of month
Returns:n with the appropriate suffix
Return type:str

Return a datetime.datetime for a datetime that was serialized with MagicJSONEncoder.

Parameters:d (dict) – dict from deserialized JSON
Returns:datetime represented by dict
Return type:datetime.datetime

Return the current datetime as a timezone-aware DateTime object in UTC.

Returns:current datetime
Return type:datetime.datetime

Remove the werkzeug logger StreamHandler (call from

With Werkzeug at least as of 0.12.1, werkzeug._internal._log sets up its own StreamHandler if logging isn’t already configured. Because we’re using the flask command line wrapper, that will ALWAYS be imported (and executed) before we can set up our own logger. As a result, to fix the duplicate log messages, we have to go back and remove that StreamHandler.


Using LOCALE_NAME and CURRENCY_CODE, return amt formatted as currency.

Parameters:amt – The amount to format; any numeric type.
Returns:amt formatted for the appropriate locale and currency
Return type:str