     y = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_separator)
     sign + currency_symbol + x + y
 
-Date.months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]
-Date::getNiceDate = ->
-  Date.months[@getMonth()] + ' ' + @getDate() + ', ' + @getFullYear()
+  toNiceDate: (date) ->
+    date = new Date(String(date))
+    @months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear()
 
-Date::getMonthName = ->
-  Date.months[@getMonth()]
+  getMonthName: (date) ->
+    date = new Date(String(date))
+    @months[date.getMonth()]
 
 class Cash
   constructor: (@robot) ->

module.exports = (robot) ->

  cash = new Cash robot

  robot.respond /cash (left|on hand)( is)? (.+)$/i, (msg) ->
    amount = cash.set_on_hand msg.match[3]
    msg.send "Ok, cash on hand is #{amount.toDollars()}"

  robot.respond /cash burn( rate)?( is)? (.+)$/i, (msg) ->
    amount = cash.set_burn_rate msg.match[3]
    msg.send "Ok, our burn rate is #{amount.toDollars()} per month"

  robot.respond /cash (stats|state|update)/i, (msg) ->
    data = cash.data()

# Author:
#   jhubert

class OutputFormatter
  months: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]

  constructor: ->
    return

  toDollars: (number, currency_symbol = (process.env.HUBOT_CASH_CURRENCY_SYMBOL or '$'), thousands_separator = (process.env.HUBOT_CASH_THOUSANDS_SEPARATOR or ',')) ->
    n = parseInt(number, 10)
    sign = if n < 0 then "-" else ""
    i = parseInt(n = Math.abs(n).toFixed(0)) + ''
    j = if (j = i.length) > 3 then j % 3 else 0
