diff options
Diffstat (limited to 'main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs')
-rw-r--r-- | main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs index 4801dc0450..6ce42aff48 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs @@ -36,6 +36,7 @@ using Mono.TextEditor; using System.Linq; using MonoDevelop.Ide.Editor; using MonoDevelop.Ide.Fonts; +using Humanizer; namespace MonoDevelop.VersionControl.Views { @@ -512,21 +513,15 @@ namespace MonoDevelop.VersionControl.Views static void DateFunc (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { - CellRendererText renderer = (CellRendererText)cell; - var rev = (Revision)model.GetValue (iter, 0); - string day; - + var renderer = (CellRendererText)cell; + var revision = (Revision)model.GetValue (iter, 0); // Grab today's day and the start of tomorrow's day to make Today/Yesterday calculations. var now = DateTime.Now; - var age = new DateTime (now.Year, now.Month, now.Day).AddDays(1) - rev.Time; - if (age.Days >= 0 && age.Days < 1) { // Check whether it's a commit that's less than a day away. Also discard future commits. - day = GettextCatalog.GetString ("Today"); - } else if (age.Days < 2) { // Check whether it's a commit from yesterday. - day = GettextCatalog.GetString ("Yesterday"); - } else { - day = rev.Time.ToShortDateString (); - } - renderer.Text = string.Format ("{0} {1:HH:mm}", day, rev.Time); + var age = new DateTime (now.Year, now.Month, now.Day).AddDays (1) - revision.Time; + + renderer.Text = age.Days >= 2 ? + revision.Time.ToShortDateString () : + revision.Time.Humanize (utcDate: false, dateToCompareAgainst: now); } static void GraphFunc (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) |