aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 3172ebf28e41e75b4da3fd044c7ee37df782e35b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# then

Then is a minimalist plain text file calendar inspired by [When](https://www.lightandmatter.com/when/when.html). It has simple syntax optimized for the average scheduling case, but supports recurring cases more complex than most calendars. It optionally supports todo lists with deadlines as well.

Then is a single binary with no dependencies optimized for people who want to manage events directly in their text editor rather than a TUI/GUI. You can columnize, group, sort, and archive events/todos in your .then file(s) to keep them neat, pretty, and human readable.

In terms of features and complexity, Then lies between [When](https://www.lightandmatter.com/when/when.html) and [Remind](https://dianne.skoll.ca/projects/remind/) but aims to be less verbose than either.

# .then file syntax

```
# COMMENT
DATE, EVENT
- DETAILS
```

- Lines beginning with `#` are comments used to annotate or group events together.
- Lines beginning with `-` are additional details attached to the above event.
- Blank lines are ignored.

Otherwise, a line is an event. Everything before the first comma is interpreted as the date, which is a list of conditions separated by whitespace. Parameters can be written in any order. Short or long month and weekday names can be used.

## Example Syntax

```
# Common dates and recurrence

2025 Jul 17,  Hike Mt. Fuji
Jan 1,        New Year's Day  (Jan 1 every year)
Tue,          Taco night      (Every Tuesday)
1,            Mortgage due    (1st of every month)
,             Journal         (Every day)

# Times

2025 Jan 1 00:00-03:00,  Work party
2025 Jan 1 04:00,        Go to bed
20:00 Fri,               Friday Night Magic  (Every Friday at 8pm)
9am,                     Coffee              (Every day at 9am)

# Logic and Date Ranges

Mon | Wed | Fri,            Submit TPS Report (Every Mon, Wed, or Fri)
Fri !13,                    Every Friday except the 13th
July 7-13 2024,             Shark Week
(Jun 25 2025)-(Jul 4 2025), Japan Trip

# Uncommon recurrence patterns

J%3,    Every third day
Fri 1W, First Friday of the month
```

## Adding details to events

Any line starting with a `-` or `+` is attached to the nearest above event. This can be used for details about an event if you don't want to put everything on one line.

```
2025 Jan 5 16:00, Doctor's Appointment
- 123 Gentoo Road, San Francisco, CA 12345
- Dr. Elias Berkins, +1 (555)-123-1234
```

## Date Groups

You can put a day, month, and optionally year in parentheses to treat it as a single date. This lets you use the date for ranges and with the `!` operator like you'd expect.

```
Sun !(Dec 25),               Every Sunday except Dec 25. The ! does NOT expand to !Dec !25.
(June 25 2025)-(Sep 1 2025), Summer vacation
(Jun 25)-(Sep 1) 2025,       Alternative summer vacation
```

## Ranges (`-`)

You can specify ranges with a dash for days, weekdays, months, years, and date groups.

```
Mon-Fri,                    Work every weekday
Jan 1-7 2025,               Las Vegas convention
(Jan 30 2025)-(Feb 3 2025), Ski trip
(Dec 25)-(Jan 2),           Christmas vacation every year
```

You can omit one end of a date range to mean before or after a certain date.

```
Fri -(Sep 13 2025),  Every Friday before Sep 13 2025
Fri (Sep 13 2025)-,  Every Friday after Sep 13 2025
```

## Logical Operators (`|`, `!`)

`|` means OR.\
`!` means NOT.\
AND is *implied* by whitespace between conditions

```
1 | 15,         Every 1st OR 15th
Fri !13,        Every Friday AND NOT the 13th
Sun !(Dec 25),  Every Sunday AND NOT December 25
2025 Aug 14,    2025 AND August AND the 14th
1 2,            Every 1st AND 2nd (never)
```

## First/last week(s) of Month (`W`, `L`)

*x*W is the *xth* set of 7 days of a month
*x*L is the *xth*-from-last set of 7 days of a month

This is mostly useful for certain Holidays.

```
May 2W Sun,   Mother's Day (Second Sunday of May)
May 1L Mon,   Memorial Day (Last Monday of May)
1W Fri,       First Friday (of every month)
```

## Time

You can express times in 24h format or AM/PM format like this. Your agenda will be sorted by the start time of events.

```
Fri 06:00,    With no am/pm, 24h time is assumed
Fri 12:00am,  Midnight
Fri 12pm,     Noon

# You can include ranges if you'd like
Fri 05:00-06:00,  Breakfast
Fri 12pm-1pm,     Lunch
```

## Modified Julian Date (`J%x+y`)

Then supports using a Modified Julian Date as `J`. `J` is the number of days since midnight November 17, 1858. This can be used along with the modulo operator `%` to create complex recurring events.

```
J%3,       Every third day
!(J%14-5), Every other Saturday
!(J%14+2), Every other Saturday (on the other weeks)
Sat J%2,   Every other Saturday expressed in a different way

# You can use it for recurring reminders too
Jul 10-19 2025 !(J%3-2), This event repeats July 10, 13, 16, 19
```

Julian date modulus is definitely weird, but it's a concise way to express multiple uncommon recurring patterns without increasing program complexity and syntax vocabulary for features I virtually never use. Plus it's an homage to [When](https://www.lightandmatter.com/when/when.html), and I love When.

## Deadline Recipe (TODO: Redo this entirely)

There is no distinction between a scheduled event and deadline but by using a less than operator `<` combined with some frequency you might create useful deadline reminders:

```
<(Aug 15 2025),                 Due 8/15 - Remind me every day
<(Aug 15 2025) Mon,             Due 8/15 - Remind me every Mon
<(Aug 15 2025) J%2,             Due 8/15 - Remind me every other day
>(Aug 10 2025) <(Aug 15 2025),  Due 8/15 - Start daily reminders on 8/10/2025

# You technically could do this as well, although I wouldn't:
<(Aug 15 2025) ((>(Aug 1 2025) J%2) | >(Aug 10 2025)), SomeProject
- Due 8/15
- Bi-daily reminders starting 8/1
- Daily reminders starting 8/10
```

# Why would I use this?

1. You live in an open source, offline, self-hosted cabin in the woods to escape the bloated, dystopian tech world
2. You want to manage your schedule directly in your text editor
3. It's fun

Then is minimal and created to meet my personal use case. If your first thought was something about mobile phone notifications or planning how to sync Then to *another* calendar program, Then is the wrong tool and you'd be overcomplicating your workflow rather than simplifying it.

## Why would I use this over When?

I love [When](https://www.lightandmatter.com/when/when.html)! Then was created to simplify When's syntax to remove special characters from average cases.

**When**: `* * 1, Mortgage Due`\
**then**: `1, Mortgage Due`

I also added optional todo/deadline features because I use calendar events like a todo list. I might complete an event like "Change air filters" early or let it run late. I want it on my calendar until it's done, or I want it gone if I've already done it.

## Why would I use this over Remind?

I love [Remind](https://dianne.skoll.ca/projects/remind/)! It is incredibly powerful. Then syntax is shorter than Remind for average cases:

**Remind**: `REM Jan 1 MSG New Years!`\
**then**: `Jan 1, New Years!`

If you deal with events with unusual recurrence patterns or conditions, Remind is arguably nicer and inarguably much more powerful:

Every 3 days between July 10-19 2025:\
**Remind**: `REM Jul 10 2025 *3 THROUGH Jul 19 2025`\
**then**: `Jul 10-19 !(J%3-2)`

If you have any case on the edge of what Then supports, or far beyond, you should use Remind instead.

# Alternatives

If you're interested in other plain text file calendars, I highly recommend When or Remind. It's easy to get caught up yak shaving the maximalist Emacs, so Org Mode is a bit of a beast.

- [When](https://www.lightandmatter.com/when/when.html) - The simplest text file calendar that's flexible enough for real world use.
- [Remind](https://dianne.skoll.ca/projects/remind/) - The opposite: The most powerful, programmable calendar program ever made (CLI or otherwise) but simple cases are easy and concise.
    - [(Better overview here.)](https://blog.thechases.com/posts/remind/)
- [Org Mode](https://orgmode.org) - An expansive productivity playground for text with agenda features, but also a time sink trap for tinkerers.

## See Also

- [khal](https://github.com/pimutils/khal) - Similar CLI calendar, but stores calendars directly as .ics files.
- TUI calendar/productivity apps like [Calcurse](https://calcurse.org/), [calcure](https://github.com/anufrievroman/calcure), and maybe [Taskwarrior](https://taskwarrior.org/).
- [Emacs Diary](https://www.gnu.org/software/emacs/manual/html_node/emacs/Format-of-Diary-File.html) - A single agenda/diary file.
- [Plain Text Personal Organizer](https://danlucraft.com/blog/2008/04/plain-text-organizer/)
- [Calendar.txt](https://terokarvinen.com/2021/calendar-txt/) - A one-day per line text calendar idea inspired by [todo.txt](https://todotxt.org/). Very simple but high maintenence due to lack of repeating events, etc.

# License

MIT