diff options
author | Sean McGivern <sean@gitlab.com> | 2016-05-05 12:00:31 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2016-05-11 12:26:37 +0300 |
commit | d9574a7b93de7e88c77ed1351650843749da60f0 (patch) | |
tree | 6fe49bddb4b52c72875b41b4947c67ed3623603e /app/views/projects/commits | |
parent | c583433862558550c8caedb03217880568dcdefc (diff) |
Group commits by date in server timezone
`Time#to_date` just takes the (timezone-less) year, date, and month, and
creates a new date from that. Because the commits in the list are
grouped by date, rather than chunked when the date changes, a commit can
be shown in the wrong order if its CommitDate has a timezone-less date
that's different to other commits around it.
Convert all CommitDates to the server timezone before grouping, as that
will at least produce consistent results. Users can still see a
timestamp on the commit that doesn't match the date it's grouped under,
because the timestamp shown uses the user's local timezone, and the
grouping uses the server's timezone, but that was an issue anyway.
Diffstat (limited to 'app/views/projects/commits')
-rw-r--r-- | app/views/projects/commits/_commits.html.haml | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml index 64e8da9201d..82f39e59284 100644 --- a/app/views/projects/commits/_commits.html.haml +++ b/app/views/projects/commits/_commits.html.haml @@ -3,7 +3,7 @@ - commits, hidden = limited_commits(@commits) -- commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits| +- commits.group_by { |c| c.committed_date.in_time_zone.to_date }.sort.reverse.each do |day, commits| .row.commits-row .col-md-2.hidden-xs.hidden-sm %h5.commits-row-date |