   # Issues /daily to the Harvest API.
   daily: (msg, callback) ->
     this.request(msg).path("/daily").get() (err, res, body) ->
+      callback res.statusCode, JSON.parse(body)
+
+  # Issues /daily/<dayofyear>/<year> to the Harvest API.
+  daily_at: (msg, date, callback) ->
+    this.request(msg).path("/daily/#{this.day_of_year(date)}/#{date.getFullYear()}").get() (err, res, body) ->
       callback res.statusCode, JSON.parse(body)
 
   # Issues /daily/add to the Harvest API to add a new timer

    msg.reply "Okay, I erased your credentials from my memory."

  # Retrieve your or a specific user's timesheet for today.
  robot.respond /daily harvest( of (.+))?/i, (msg) ->
    unless user = check_user(robot, msg, msg.match[2])
      return
    harvest = new HarvestService(user.harvest_account)

    try
      harvest.daily msg, (status, body) ->
        if 200 <= status <= 299
          msg.reply "Your entries for today, #{user.name}:"
          for entry in body.day_entries
            if entry.ended_at == ""
              msg.reply "• #{entry.project} (#{entry.client}) → #{entry.task} <#{entry.notes}> [running since #{entry.started_at} (#{entry.hours}h)]"
            else
              msg.reply "• #{entry.project} (#{entry.client}) → #{entry.task} <#{entry.notes}> [#{entry.started_at} – #{entry.ended_at} (#{entry.hours}h)]"
        else
          msg.reply "Request failed with status #{status}."
    catch error
      msg.reply("Fatal error: #{error}")



        # Execute the callback with the result
        callback found_entry

  # Takes a Date object and figures out which day in its
  # year it represents and returns that one. Leap years
  # are honoured.
  day_of_year: (date) ->
    start = new Date(date.getFullYear(), 0, 0)
    return Math.ceil((date - start) / 86400000)
