       cb json_body
 
 withCurrentOncall = (msg, cb) ->
-  now = new Date()
-  oneHour = now.addHours(1).toISOString()
-  now = now.toISOString()
+  oneHour = moment().add('hours', 1).format()
+  now = moment().format()
+
   query = {
     since: now,
     until: oneHour,

module.exports = (robot) ->
  robot.respond /pager( me)?$/i, (msg) ->

    cmds = robot.helpCommands()
    cmds = (cmd for cmd in cmds when cmd.match(/(pager me |who's on call)/))
    msg.send cmds.join("\n")

  # Assumes your Campfire usernames and PagerDuty names are identical
  robot.respond /pager( me)? (\d+)/i, (msg) ->
    withPagerDutyUsers msg, (users) ->
      username  = msg.message.user.name
      if username == "Shell"
        username = process.env.USER
      userId    = users[username].id
      now       = new Date()
      start     = now.toISOString()
      minutes   = parseInt msg.match[2]
      end       = now.addMinutes(minutes).toISOString()
      override  = {
        'start':     start,
        'end':       end,

        data = { 'override': override }
        pagerDutyPost msg, "/schedules/#{process.env.HUBOT_PAGERDUTY_SCHEDULE_ID}/overrides", data, (json) ->
          if json.override
            start = moment(json.override.start)
            end = moment(json.override.end)
            msg.send "Rejoice, #{old_username}! #{json.override.user.name} has the pager from #{start.calendar()} until #{end.calendar()}"

  robot.respond /(pager|major)( me)? (inc|incidents|sup|problems)$/i, (msg) ->
    pagerDutyIncidents msg, (incidents) ->
