Skip to content

feat: rrule and ruleset validate - #8

Merged
shavonn merged 1 commit into
mainfrom
feat/rrule-ruleset-validate
Feb 22, 2026
Merged

feat: rrule and ruleset validate#8
shavonn merged 1 commit into
mainfrom
feat/rrule-ruleset-validate

Conversation

@shavonn

@shavonn shavonn commented Feb 22, 2026

Copy link
Copy Markdown

Add validate function for checking RRULE and RRuleSet strings without throwing.

  • New validate(s, options?) function that returns { valid: true } or { valid: false, error: { message, cause } }
  • Accepts the same string formats and options as rrulestr
  • Exported ValidationResult, ValidationSuccess, and ValidationError types

Copilot AI review requested due to automatic review settings February 22, 2026 04:39
@shavonn
shavonn merged commit 21584c1 into main Feb 22, 2026
5 checks passed
@shavonn
shavonn deleted the feat/rrule-ruleset-validate branch February 22, 2026 04:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new validate function to provide a safe, non-throwing way to validate RRULE and RRuleSet strings. The function wraps the existing rrulestr parser and returns a discriminated union indicating success or failure with detailed error information.

Changes:

  • New validate function that accepts the same inputs as rrulestr but returns a validation result instead of throwing
  • Three new TypeScript types exported: ValidationResult, ValidationSuccess, and ValidationError
  • Comprehensive test coverage for both valid and invalid inputs, including edge cases

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/validate.ts Implements the core validation function that wraps rrulestr in try-catch and returns structured validation results
src/index.ts Exports the new validate function and associated TypeScript types
test/validate.test.ts Comprehensive test suite covering valid inputs, invalid inputs, and contract guarantees (never throws)
README.md Documentation for the validate function including usage examples and TypeScript type definitions
.changeset/heavy-times-turn.md Changeset entry describing the new minor feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md

```js
import { datetime, RRule, RRuleSet, rrulestr } from 'rrule'
import { datetime, RRule, RRuleSet, rrulestr, validate } from 'rrule'

Copilot AI Feb 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent package name in import statement. This line uses 'rrule' while the new validate examples added in lines 166 and 770 use '@offload-project/rrule'. Consider using the full package name '@offload-project/rrule' consistently throughout the documentation, or using the short form 'rrule' consistently.

Suggested change
import { datetime, RRule, RRuleSet, rrulestr, validate } from 'rrule'
import { datetime, RRule, RRuleSet, rrulestr, validate } from '@offload-project/rrule'

Copilot uses AI. Check for mistakes.
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.

2 participants