commit e23fb307176f08f4d012122fa557d27b95b59426
parent 663ec708584c1aeba7fd5ea7dec268adb21f8c41
Author: Jeff <dev@watertao.xyz>
Date: Sun, 10 Aug 2025 17:32:14 -0700
Fixed a little glitch in month/year display
Diffstat:
M | entries.awk | | | 46 | ++++++++++++++++++++++------------------------ |
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/entries.awk b/entries.awk
@@ -3,7 +3,6 @@ function date_f(s)
{
b_first_date = ( first_date == 0 )
( b_first_date ) && p_date_type = date_type
- ( b_first_date ) && date_type = "day"
# m/d/y date to ymd
( s ~ /\// ) && s = sprintf( "%s%s%s", substr(s, 7, 4), substr(s, 1, 2), substr(s, 4, 2) )
@@ -14,12 +13,15 @@ function date_f(s)
b = mktime( a )
if ( s == strftime( "%Y%m%d" ) ) {
r = sprintf( "%s %s", stoday, strftime( "%a %d", b ) )
+ ( b_first_date ) && date_type = "today"
} else if ( s == tomorrow ) {
r = sprintf( "%s %s", stomorrow, strftime( "%a %d", b ) )
+ ( b_first_date ) && date_type = "tomorrow"
} else if ( s == yesterday ) {
r = sprintf( "%s %s", syesterday, strftime( "%a %d", b ) )
+ ( b_first_date ) && date_type = "yesterday"
} else if ( b < plus7 && b > minus7 ) {
r = sprintf( "%s", strftime( "%a %d", b ) )
@@ -51,30 +53,26 @@ function date_fmt_from_regex( rgx, mmax )
function print_seperator()
{
-
- if (date_type == "day") {
- if (rdate != pdate) {
- pdate = rdate
- if (pr_count > 1) { print "" }
- }
- } else if ((p_date_type != date_type) && (date_type != "etal")) {
+ m = substr(rdate, 5, 2)
+ y = substr(rdate, 1, 4)
+ if (y != yr) {
+ yr = y
print ""
- } else {
- m = substr(rdate, 5, 2)
- y = substr(rdate, 1, 4)
- if (y != yr) {
- yr = y
- print ""
- print " ---- "
- print "[ " y " ]"
- print " ---- "
- }
- if (rdate != pdate && m != mnth) {
- pdate = rdate
- mnth = m
- print ""
- print " < " m " >"
- }
+ print " ---- "
+ print "[ " y " ]"
+ print " ---- "
+ sep=1
+ }
+ if (rdate != pdate && m != mnth) {
+ pdate = rdate
+ mnth = m
+ print ""
+ print " < " m " >"
+ sep=1
+ }
+ if (sep){ return 0 }
+ if (p_date_type != date_type) {
+ if (pr_count > 1) { print "" }
}
}