Lurker News

Comments (98) 41 threads

Show all comments

Showing thread 6 of 41

intrepidhero2 replies#
This is pretty clever and I admire the author for coming up with an elegant way to show the mapping of week days to dates. I'd be particularly interested to see the algorithm behind it. Date computations are very tricky.

A few years ago I made script to generate a one page calendar because the ones they hand out at work are particularly ugly. In addition to showing the date<->weekday mapping I also wanted it to show holidays and pay periods. This is one of the (few) things stuck on my wall.
https://intrepidhero.gitlab.io/mkcal/cal2020.html
https://gitlab.com/intrepidhero/mkcal

kohtatsu1 reply#
Generate grid (it's static);

Find first weekday of month using your favourite algorithm;
Print month's name above the column that begins with that weekday.

intrepidhero1 reply#
favourite algorithm is left as an exercise to the reader. ;-)
zamadatix#
Favorite algorithm can be as simple as "look at the first day of each month on a normal calendar".
IshKebab#
Date computations like this are not at all tricky.