From a445630ff353bdd9c5be24ccfd3380c71d3901d1 Mon Sep 17 00:00:00 2001
From: Phil Hughes <me@iamphill.com>
Date: Mon, 4 Jul 2016 12:38:01 +0100
Subject: [PATCH] Added day name to contributions calendar

Closes #19367
---
 CHANGELOG                                                   | 1 +
 app/assets/javascripts/lib/utils/datetime_utility.js.coffee | 4 ++++
 app/assets/javascripts/users/calendar.js.coffee             | 5 +++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 5f593336895..1bd22e4c96f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@ v 8.10.0 (unreleased)
   - Apply the trusted_proxies config to the rack request object for use with rack_attack
   - Add Sidekiq queue duration to transaction metrics.
   - Let Workhorse serve format-patch diffs
+  - Added day name to contribution calendar tooltips
   - Make images fit to the size of the viewport !4810
   - Fix check for New Branch button on Issue page !4630 (winniehell)
   - Fix MR-auto-close text added to description. !4836
diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js.coffee b/app/assets/javascripts/lib/utils/datetime_utility.js.coffee
index 948d6dbf07e..178963fe0aa 100644
--- a/app/assets/javascripts/lib/utils/datetime_utility.js.coffee
+++ b/app/assets/javascripts/lib/utils/datetime_utility.js.coffee
@@ -2,10 +2,14 @@
 
   w.gl ?= {}
   w.gl.utils ?= {}
+  w.gl.utils.days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
 
   w.gl.utils.formatDate = (datetime) ->
     dateFormat(datetime, 'mmm d, yyyy h:MMtt Z')
 
+  w.gl.utils.getDayName = (date) ->
+    this.days[date.getDay()]
+
   w.gl.utils.localTimeAgo = ($timeagoEls, setTimeago = true) ->
     $timeagoEls.each( ->
           $el = $(@)
diff --git a/app/assets/javascripts/users/calendar.js.coffee b/app/assets/javascripts/users/calendar.js.coffee
index c081f023b04..c49ba5186f2 100644
--- a/app/assets/javascripts/users/calendar.js.coffee
+++ b/app/assets/javascripts/users/calendar.js.coffee
@@ -87,14 +87,15 @@ class @Calendar
       .attr 'width', @daySize
       .attr 'height', @daySize
       .attr 'title', (stamp) =>
+        date = new Date(stamp.date)
         contribText = 'No contributions'
 
         if stamp.count > 0
           contribText = "#{stamp.count} contribution#{if stamp.count > 1 then 's' else ''}"
 
-        date = dateFormat(stamp.date, 'mmm d, yyyy')
+        dateText = dateFormat(date, 'mmm d, yyyy')
 
-        "#{contribText}<br />#{date}"
+        "#{contribText}<br />#{gl.utils.getDayName(date)} #{dateText}"
       .attr 'class', 'user-contrib-cell js-tooltip'
       .attr 'fill', (stamp) =>
         if stamp.count isnt 0
-- 
GitLab