markwhen icon indicating copy to clipboard operation
markwhen copied to clipboard

First/Last day of the week/month/year

Open Alsan opened this issue 2 years ago • 3 comments

How can I recurrent an event for fist/last day of the week/month/year?

Alsan avatar Mar 22 '23 02:03 Alsan

That's not currently supported. Good idea though.

kochrt avatar Apr 04 '23 13:04 kochrt

Second this. Similarly, I don't believe there's a way to add an event that's on "every second Monday of the month", for example.

I would like to track when Mother's Day is on each year, but I don't believe this is possible with the current parser version.

Are you open to pull requests, @kochrt?

quinn-p-mchugh avatar Apr 13 '23 04:04 quinn-p-mchugh

I am, you might try starting here https://github.com/mark-when/parser/blob/main/src/dateRange/checkRecurrence.ts

I guess the syntax would be something like (range) every [first|second|third|last] (dayOfWeek) (amount)?

2023-04-07 every first friday x100
2023-04-07 every other friday for 1 year
2023-04-07 every last monday

A good question would be whether the initial date should be shown or included in the recurrence if it doesn't follow its own recurrence - like if it was 2023-04-13 every monday but 2023-04-13 is a Thursday.

It could get a bit complicated if we did annual dates too:

every May 14
every first Monday in September (??)

This is an aside but another thing I want to add is til or until instead of specifying a specific number of times:

2023-04-07 every friday until 2024-01-01

kochrt avatar Apr 13 '23 13:04 kochrt