Skip to content

Handling of FREQ in recurrence pattern #788

@axunonb

Description

@axunonb

FrequencyType.None

The FrequencyType.None value should be removed because it is neither meaningful in the context of frequency enumeration nor does it have a valid string representation. Its presence could lead to confusion when users create a RecurrencePattern.

In turn RecurrencePattern.Frequency should either become nullable or - for simplicity - have a default value (e.g. FrequencyType.Yearly.

The only test for a valid FrequencyType is necessary in RecurrencePatternSerializer where an invalid input string should throw.

Check for valid RecurrencePattern.Frequency in Evaluator

Currently we have a check for a valid FrequencyType, that originates in the existence of FrequencyType.None.

// FIXME: use a more specific exception.
default:
throw new Exception("FrequencyType.NONE cannot be evaluated. Please specify a FrequencyType before evaluating the recurrence.");

However, Frequency should always be valid at this stage.
The default case should just trigger a Debug.Fail as a safeguard indicating a missing implementation.
There is no need to throw an Exception for users.

Originally posted by @axunonb in #785 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions