Skip to content

approxidate: tweak special date formats

Tuomas Ahola git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 2 repliesIn review
  2. v44 patches 0 repliesSuperseded
  3. v34 patches 6 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v23 patches3 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4approxidate: make "today" wrap to midnightDocumentation/rev-list-options.adoc date.c t/t0006-date.sh+16 -10 replies
2/4t0006: add support for approxidate test date adjustmentt/t0006-date.sh+32 -10 replies
3/4approxidate: make "specials" respect fixed day-of-monthdate.c t/t0006-date.sh+9 -10 replies
4/4approxidate: use deferred mday adjustments for "specials"date.c t/t0006-date.sh+25 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/4] approxidate: tweak special date formats
Quoted 2 lines

"Friday noon" asked in the morning on Sunday was parsed to be one day before the specified time, which has been corrected.

Should we add something about the new semantics of "today"?

Tuomas Ahola (4):
approxidate: make "today" wrap to midnight
t0006: add support for approxidate test date adjustment
approxidate: make "specials" respect fixed day-of-month
approxidate: use deferred mday adjustments for "specials"

 Documentation/rev-list-options.adoc |  3 +-
 date.c                              | 46 ++++++++++++++++++++++-------
 t/t0006-date.sh                     | 44 ++++++++++++++++++++++++++-
 3 files changed, 81 insertions(+), 12 deletions(-)

Interdiff mot v4:

date.c +2 -1
index 6e7cf907da..05b78d852f 100644
@@ -1206,12 +1206,13 @@ static void date_never(struct tm *tm, struct tm *now UNUSED, int *num)
 	*num = 0;
 }
 
-static void date_today(struct tm *tm, struct tm *now, int *num UNUSED)
+static void date_today(struct tm *tm, struct tm *now, int *num)
 {
 	if (tm->tm_hour == now->tm_hour &&
 	    tm->tm_min == now->tm_min &&
 	    tm->tm_sec == now->tm_sec)
 		date_time(tm, 0);
+	*num = 0;
 	tm->tm_mday = -1;
 	update_tm(tm, now, 0);
 }
t/t0006-date.sh +2 -1
index b187b1bfc4..9a76b84ed9 100755
@@ -212,13 +212,14 @@ check_approxidate 'noon today' '2009-08-30 12:00:00'
 check_approxidate 'today at noon' '2009-08-30 12:00:00' '-12 hours'
 check_approxidate 'noon today' '2009-09-01 12:00:00' '+36 hours'
 check_approxidate 'noon yesterday' '2009-08-29 12:00:00'
+check_approxidate 'noon yesterday' '2009-08-29 12:00:00' '-12 hours'
 check_approxidate 'last Friday at noon' '2009-08-28 12:00:00'
 check_approxidate 'last Friday at noon' '2009-08-28 12:00:00' '-12 hours'
-check_approxidate 'noon yesterday' '2009-08-29 12:00:00' '-12 hours'
 check_approxidate 'tea last saturday' '2009-08-29 17:00:00'
 check_approxidate 'tea last saturday' '2009-08-29 17:00:00' '-12 hours'
 check_approxidate 'January 5th noon pm' '2009-01-05 12:00:00'
 check_approxidate 'January 5th noon pm' '2009-01-05 12:00:00' '-12 hours'
+check_approxidate 'January 5th today pm' '2009-01-30 12:00:00'
 check_approxidate '10am noon' '2009-08-29 12:00:00'
 check_approxidate 'January 5th yesterday' '2009-01-29 19:20:00'
 check_approxidate 'January 5th yesterday' '2008-12-31 19:20:00' '+2 days'

base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0

Signature · 1 line
2.30.2