Functional Weave
Code in Rust

todo.recurrence-label@1.0.0

README.md

1,276 bytes · view raw

# todo.recurrence-label

The English words for a repeating todo's chip, from its rule:

| rule | label |
| --- | --- |
| daily, 1 / 3 | Every day / Every 3 days |
| weekdays | Every weekday |
| weekly, 1 / 2 | Every week on Monday / Every 2 weeks on Monday |
| monthly, 1 / 3 | Every month on the 31st / Every 3 months on the 1st |
| yearly, 1 / 2 | Every year on 29 Feb / Every 2 years on 1 Jan |

The weekday, day of the month and date all come from the anchor, the date
todo.next-occurrence counts every occurrence from (weekday via
dates.day-of-week). Ordinals are 1st 2nd 3rd, 4th to 20th (so 11th, 12th,
13th), then 21st 22nd 23rd and 31st.

A monthly rule on the 29th, 30th or 31st falls on the last day of shorter
months, and a yearly rule on 29 Feb falls on 28 Feb outside leap years
(todo.next-occurrence); the label names the anchor's day and does not repeat
that caveat, so an app that wants to say it should add it.

Invalid rules fail with todo.next-occurrence's messages: an unknown
frequency, an interval below 1 (or not a whole number), a weekday rule with an
interval other than 1, and an anchor that is not a real ISO date (dates.add-days's
messages). Like todo.next-occurrence it does not enforce todo.item's upper
limit of 999; todo.item's validators do.