[gitg] Fix date format in commit history view



commit 13795da99481dab060fe30654b83ed3567866cd8
Author: Sindhu S <sindhus live in>
Date:   Fri May 3 00:18:28 2013 +0530

    Fix date format in commit history view
    
    If commits are in current calendar year, show date in format
    %h %e, %I:%M %P. If commits are not in current calendar year,
    show full year (that is, with century) information using %Y.
    
    Add comment on fixing code to make Gitg honour user locales.
    https://bugzilla.gnome.org/show_bug.cgi?id=699196

 libgitg/gitg-commit.vala |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libgitg/gitg-commit.vala b/libgitg/gitg-commit.vala
index ba65693..0e27ab7 100644
--- a/libgitg/gitg-commit.vala
+++ b/libgitg/gitg-commit.vala
@@ -129,8 +129,12 @@ public class Commit : Ggit.Commit
                {
                        return "%d days ago".printf((int)Math.round(t / (3600 * 24)));
                }
-
-               return dt.to_timezone(time_zone).format("%x %X %z");
+               // FIXME: Localize these date formats, Bug 699196
+               else if (dt.get_year() == new DateTime.now_local().get_year())
+               {
+                       return dt.to_timezone(time_zone).format("%h %e, %I:%M %P");
+               }
+               return dt.to_timezone(time_zone).format("%h %e %Y, %I:%M %P");
        }
 
        public string committer_date_for_display


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]