Skip to content

Commit

Permalink
;tools: just twih: date fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed Jun 25, 2024
1 parent 007f2eb commit 831b463
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -920,17 +920,20 @@ NEWS:
# @_datearg *DATEARG:
# echo {{ if DATEARG == '' { `just reldate` } else { if DATEARG =~ '^\d+$' { `dateadd $(date +%Y-%m-%d) -$DATEARG` } else { DATEARG } } }}

#dateround := 'dateround -n'
dateround := 'dateround'

# If DATE is provided, return it, otherwise the date two fridays ago.
@_dateorsecondlatestfriday *DATE:
echo {{ if DATE == '' { `gdate -I -d "$(dateround today -n -- -fri) - 1 week"` } else { DATE } }}
echo {{ if DATE == '' { `gdate -I -d "$($dateround today -- -fri) - 1 week"` } else { DATE } }}

# If DATE is provided, return today's date, otherwise the most recent friday's (possibly today).
@_todayorlatestfriday *DATE:
echo {{ if DATE == '' { `dateround today -n -- -fri` } else { `$GDATE -I` } }}
echo {{ if DATE == '' { `$dateround today -- -fri` } else { `$GDATE -I` } }}

# If DATE is provided, return tomorrow's date, otherwise last friday's.
@_tomorroworlatestfriday *DATE:
echo {{ if DATE == '' { `dateround today -n -- -fri` } else { `$GDATE -I -d tomorrow` } }}
echo {{ if DATE == '' { `$dateround today -- -fri` } else { `$GDATE -I -d tomorrow` } }}

# Show a draft This Week In Hledger post, with activity between the last two fridays (by default)
twih: # *DATE:
Expand Down

0 comments on commit 831b463

Please sign in to comment.