CalendarBlocker helps you block time randomly and quickly, with a .ics calendar feed set to your desired availability.
Using random (but deterministic) blocks of unavailable time, you can quickly populate an otherwise sparse calendar app, including Apple or Google; or randomly limit availability in a scheduling app, including Cal.com and SavvyCal.
For example, CalendarBlocker in Apple Calendar, set to 1 hour blocks and 50% share:
blocker.andrewe.ca/calendar.ics?h=1&share=0.50
- generate a unique
.icscalendar feed of unavailable time - deterministic pseudo-random availability based on your seed value, share, and time block
- time blocks begin each day at midnight (00:00) in the timezone specified
Add or Subscribe: blocker.andrewe.ca/calendar
Add or subscribe to CalendarBlocker in your calendar or scheduling app. You can include the optional .ics file extension and set DAYS, HOURS, and share in the URL query:
https://blocker.andrewe.ca/calendar
https://blocker.andrewe.ca/calendar.ics
https://blocker.andrewe.ca/calendar.ics?days=7&hours=4&share=0.35
https://blocker.andrewe.ca/calendar.ics?d=14&h=3&start=0.50&end=0.20
CalendarBlocker is a Cloudflare Worker (serverless function) that generates unique .ics calendar feeds.
Deploy your own Cloudflare Worker to change additional settings (using environment variables) including NAME, SEED, SEED_VIA_URL, and TIMEZONE,
- Clone this repo:
git clone https://github.com/andesco/CalendarBlocker.git
cd CalendarBlocker- Customize default variables in
wrangler.jsoncas needed. Example:
Install Wrangler CLI, login, and deploy: : Wrangler is the Cloudflare Developer Platform command-line interface (CLI)
*[CLI]: Hyper Text Markup Language
npm install -g wrangler
wrangler login
npm run deployFor a private deployment config, create wrangler.local.jsonc and deploy with:
npm run deploy:localAdd or subscribe to a calendar using your worker subdomain, a custom subdomain, or blocker.andrewe.ca:
https://blocker.username.workers.dev/calendar.ics
https://subdomain.personal.com/calendar.ics
https://blocker.andrewe.ca/calendar.ics
Calendar feeds generate consistent blocks of time based on the seed being used. To get a new set of randomized (but deterministic) blocks of time, update your Cloudflare Worker environment variables:
- change the default value of
SEED; or - set
SEED_VIA_URLtotrueand set an optional per-calendarSEEDin the URL query:https://subdomain.personal.com/calendar?seed=random-seed-value
share defines the share of possible time blocks that should be blocked for each day. For example, with h=3, each day has 8 possible blocks. share=0.50 selects 4 of those blocks, and share=0.35 selects about 35% of them, rounded to the nearest whole block.
Each possible block gets a stable score based on the seed, date, and start time; CalendarBlocker selects the lowest-scored blocks until it reaches the requested share, which keeps refreshes consistent for the same seed.
Optionally, use the URL parameters start and end together to create a declining share across the generated calendar window:
https://blocker.andrewe.ca/calendar.ics?d=14&h=3&start=0.50&end=0.20
With d=14, CalendarBlocker generates day 0 through day 14. In the example above, day 0 uses 50% share, day 7 uses 35% share, and day 14 uses 20% share.
Declining mode is designed so future blocks remain stable as the calendar refreshes. A date that was 14 days away at 20% share will use a higher share as it gets closer, so previously blocked slots stay blocked while additional slots may become blocked. For that guarantee, start must be greater than or equal to end.
If share is set in the URL, it takes precedence over start and end and applies the same share to every day.
| Variable | Description | Default |
|---|---|---|
DAYS |
number of days: 1–21 | 14 |
HOURS |
hours in each block of time: 0.5, 1, 2, 3, 4, 6, 8, 12, 24 |
3 |
SHARE |
share of time blocks to block: 0.00–1.00 | 0.50 |
TIMEZONE |
IANA timezone identifier | America/Toronto |
NAME |
calendar/event name displayed in apps | CalendarBlocker |
REDIRECT |
redirects hostname root | andesco/CalendarBlocker |
SEED |
default seed value | default-seed-value |
SEED_VIA_URL |
enable setting SEED via URL query: true, false |
false |
| Variable | Description |
|---|---|
days d |
number of days: 1–21 |
hours h |
hours in each block of time: 0.5, 1, 2, 3, 4, 6, 8, 12, 24 |
share |
share of time blocks to block: 0.00–1.00 |
start |
optional; share for day 0 in declining mode: 0.00–1.00. No default. |
end |
optional; share for the final generated day in declining mode: 0.00–1.00. No default. |
seed |
calendar-specific seed value if SEED_VIA_URL is true |
Compatibility note: the environment variable PROBABILITY is still accepted as a fallback default share, and URL parameters probability and p are still accepted as aliases for share. Any flat share value takes precedence over start and end.
{ "vars": { "DAYS": "21", "HOURS": "4", "SHARE": "0.25", "TIMEZONE": "America/Vancouver" } }