From ec72cbfd3b38de64d430ebb0659370fb075ca251 Mon Sep 17 00:00:00 2001 From: plgruener Date: Sun, 5 Nov 2017 19:02:33 +0100 Subject: [PATCH] Adjust case of reldate letters according to ISO-8601 This commit fixes the wrong use of 'm' for month and 'M' for minute: In ISO-8601, uppercase letters YYYY-MM-DD are used to denote year,month,week,day; whereas lowercase letters hh:mm:ss are used for hour,minute,second. Closes #759 --- NEWS.adoc | 1 + src/util.c | 10 +++++----- test/main/date-test | 48 ++++++++++++++++++++++----------------------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/NEWS.adoc b/NEWS.adoc index deb0681fb..bf89eec5b 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -12,6 +12,7 @@ Improvements: - Change the blame view to render more like `git blame`. (GH #812) - Improve worktree and submodule support. (GH #459, #781, #783) - Support running Tig via a Git alias. (GH #763) + - Use ISO-8601 letters for short relative dates. (GH #759) Bug fixes: diff --git a/src/util.c b/src/util.c index 0684a2a9b..47e8207de 100644 --- a/src/util.c +++ b/src/util.c @@ -133,12 +133,12 @@ struct reldate { static const struct reldate reldate[] = { { "second", 's', 1, 60 * 2 }, - { "minute", 'M', 60, 60 * 60 * 2 }, + { "minute", 'm', 60, 60 * 60 * 2 }, { "hour", 'h', 60 * 60, 60 * 60 * 24 * 2 }, - { "day", 'd', 60 * 60 * 24, 60 * 60 * 24 * 7 * 2 }, - { "week", 'w', 60 * 60 * 24 * 7, 60 * 60 * 24 * 7 * 5 }, - { "month", 'm', 60 * 60 * 24 * 30, 60 * 60 * 24 * 365 }, - { "year", 'y', 60 * 60 * 24 * 365, 0 }, + { "day", 'D', 60 * 60 * 24, 60 * 60 * 24 * 7 * 2 }, + { "week", 'W', 60 * 60 * 24 * 7, 60 * 60 * 24 * 7 * 5 }, + { "month", 'M', 60 * 60 * 24 * 30, 60 * 60 * 24 * 365 }, + { "year", 'Y', 60 * 60 * 24 * 365, 0 }, }; static const char * diff --git a/test/main/date-test b/test/main/date-test index d7cdfde5b..694e5f64a 100755 --- a/test/main/date-test +++ b/test/main/date-test @@ -126,30 +126,30 @@ EOF assert_equals 'relative-compact-date.screen' <