Hacker News new | ask | show | jobs
by s0fasurfa 477 days ago
Nice idea, but the calendar format is a bit verbose for my taste. Week number is something I would have to look up constantly and surely get wrong more than once.

If you want to follow UNIX philosophy, why don't you write an augmenter/converter tool `caug` that adds "computed" information such as week number, weekday or even relative date?

  > cat calendar-src.txt

    2025
    ====
    03-01 9-12 project groups

  > cat calendar-src.txt | caug
    2025-03-01 w09 09:00-12:00 project groups +tomorrow 
    +thisweek

  > cat calendar-src.txt | caug | grep "thisweek"
    2025-03-01 w09 09:00-12:00 project groups +tomorrow 
    +thisweek
2 comments

That was my first thought too; I often use Google Sheets/Excel as a lightweight todo calendar, and I'll make formulas to calculate week-of-year and day-of-week. These lists are so lightweight and adhoc that having to do that kind of calculation would be enough friction to not maintain the lists after a short period
I use a template [1] that includes week numbers.

With some traditional GUI calendar software, I was often hunting and miscopying week numbers. Some software also had a weird (non ISO-8601) idea of week numbers.

In case you need calendar.txt after 2033, I wrote a small tool [2] to generate more templates.

[1] https://terokarvinen.com/2021/calendar-txt/calendar-txt-unti...

[2] https://terokarvinen.com/2021/calendar-txt/calendartxt-gener...

I also wrote a small tool to generate more templates, and it fits in a comment:

  usage: weeks YYYY-MM-DD YYYY-MM-DD
  
  weeks () {
      one_day=$((60 * 60 * 24))
      unix_from=$(date +%s --date="$1")
      unix_to=$(date +%s --date="$2")
  
      while [ $unix_from -lt $unix_to ]
      do
          echo @$unix_from
          unix_from=$((unix_from + one_day))
      done | date +'%F w%V %a' -f -
  
      unset -v one_day unix_from unix_to
  }
seriously, what's a compressed 1.2MB small tool?
Nice!

Static binaries generated by Go are indeed large, even if the source code here is under 30 lines with support to some additional minor features (US and Finnish day names, command line help, optional week headings, day counts and parameter handling).

Here are some more scripts to generate calendar.txt date format:

https://terokarvinen.com/2024/format-date-calendar-txt/