Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Last active July 19, 2024 20:53
Show Gist options
  • Save typeoneerror/7cc533632c652ae542067c6dcaf5ca67 to your computer and use it in GitHub Desktop.
Save typeoneerror/7cc533632c652ae542067c6dcaf5ca67 to your computer and use it in GitHub Desktop.
Formatted Day of Week (Notion Formula)
lets(
/* number of day of week, 0-6 (starting with sunday as 0) */
no, prop("Date").formatDate("d").toNumber(),
/* day name */
day, prop("Date").formatDate("dddd"),
/* save the colors we want for each day */
color, ifs(
no == 1, "blue", /* mon */
no == 2, "pink", /* tue */
no == 3, "yellow", /* wed */
no == 4, "purple", /* thu */
no == 5, "orange", /* fri */
no == 6, "green", /* sat */
"red" /* sun */
),
/* style the day name with color and background */
day.style("b", color, color + "_background")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment