Skip to content

Adding time interval blocking#100

Open
julienbovet wants to merge 5 commits into
penge:masterfrom
julienbovet:master
Open

Adding time interval blocking#100
julienbovet wants to merge 5 commits into
penge:masterfrom
julienbovet:master

Conversation

@julienbovet

Copy link
Copy Markdown

Hello there!

This is a PR to add time-interval blocking features to block site.

julienbovet and others added 5 commits January 12, 2026 13:57
Users can now specify when sites should be blocked using time ranges and day ranges. Sites without time intervals continue to be blocked 24/7, maintaining backward compatibility.

Examples:
- example.com 9:00-17:00 (block 9am-5pm daily)
- facebook.com Mon-Fri 9:00-17:00 (block weekdays only)
- youtube.com Sat-Sun (block weekends all day)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add time interval support for site blocking
This allows users to specify complex blocking schedules with:
- Multiple time ranges per entry (e.g., block mornings and afternoons separately)
- Different schedules for different days (e.g., weekday vs weekend hours)
- Lunch break scenarios (e.g., 9:00-12:00 14:00-17:00)

Examples:
- example.com 9:00-12:00 14:00-17:00
- facebook.com Mon-Fri 9:00-12:00 14:00-17:00
- youtube.com Mon-Fri 9:00-17:00 Sat 10:00-14:00

Changes schedules from single objects to arrays while maintaining
full backward compatibility with existing single time range syntax.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add Time-based blocking section to README with examples
- Document multiple time ranges, day ranges, and multiple schedules
- Bump version from 8.2.1 to 8.3.0 for new feature

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@julienbovet

Copy link
Copy Markdown
Author

Summary

Adds support for multiple time ranges and complex blocking schedules, enabling users to:

Specify multiple time ranges per entry (e.g., block morning and afternoon with lunch break)
Define different schedules for different days (e.g., weekday hours vs. weekend hours)
Create complex blocking patterns with multiple day-time combinations
New Syntax Examples

Multiple time ranges (no lunch blocking)

example.com 9:00-12:00 14:00-17:00

Multiple times on specific days

facebook.com Mon-Fri 9:00-12:00 14:00-17:00

Different schedules for different days

youtube.com Mon-Fri 9:00-17:00 Sat 10:00-14:00

Complex: weekdays (morning+afternoon) + Saturday (morning only)

reddit.com Mon-Fri 9:00-12:00 14:00-18:00 Sat 10:00-12:00
Implementation Details
Data structure: Changed from single objects to arrays (schedule → schedules[], timeRange → timeRanges[])
Parser: Smart lookahead algorithm that groups schedules by day patterns
Validation: OR semantics - blocks if ANY schedule matches and ANY time range within that schedule matches
Backward compatibility: Fully maintained - all existing single time range formats still work
Test Coverage
76 tests passing (67 original + 9 new)
All backward compatibility tests pass
New tests cover:
Multiple time ranges without days
Multiple time ranges with days
Multiple schedules with different days
Complex combinations
Edge cases (time before day pattern, multiple day patterns, etc.)
Build Status
✅ Build successful for both Chrome and Firefox

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant