Selectable dates

The NepaliSelectableDates predicate used to constrain which dates a UI or validation layer accepts. The before_, after_, and date_range factories live on NepaliDateConverter.

Predicate over a date that consumers use to enable or disable individual days and years.

Useful for validating whether a date is allowed by some rule: a range, a weekend, a day the institution is closed. The converter factories (NepaliDateConverter.before_date_selectable and the like), the event helpers and NepaliCalendarPolicy.as_selectable_dates all produce instances of this type.

class NepaliSelectableDates[source]

Bases: object

Base predicate. Both methods default to allowing everything.

Subclass and override, or use the converter and event factories, which return ready-made instances.

is_selectable_date(custom_calendar)[source]

Return True if custom_calendar should be selectable.

Return type:

bool

is_selectable_year(year)[source]

Return True if year should be selectable.

When a year is not selectable, all dates in that year are also not selectable.

Parameters:

year (int)

Return type:

bool