# Interface ICalendar OptimaJet.Workflow.Core.Runtime.Calendars.ICalendar Represents a calendar that defines workdays and working-time boundaries. Namespace: [OptimaJet.Workflow.Core.Runtime.Calendars](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Calendars/) ```csharp public interface ICalendar ``` ## Type Hierarchy - ICalendar Current type - Implementing types - [Calendar](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Calendars/Calendar/) ## Properties `string Name { get; set; }` Gets or sets the calendar name. `TimeSpan WorkingHours { get; set; }` Gets or sets the default working duration for a workday. `TimeSpan StartOfWork { get; set; }` Gets or sets the default start time of the workday. `List Weekends { get; set; }` Gets or sets the days of week that are weekends. `Dictionary Years { get; set; }` Gets or sets year-specific calendar settings. ## Methods `bool IsWorkday(DateTime day)` Determines whether the specified date is a workday. ### Parameters | Name | Type | Description | | --- | --- | --- | | `day` | `DateTime` | The date to evaluate. | ### Returns | Type | Description | | --- | --- | | `Boolean` | `true` if the date is a workday; otherwise, `false`. | `bool IsWorkTime(DateTime datetime)` Determines whether the specified date is a workday and its time has not passed the end of that workday. ### Parameters | Name | Type | Description | | --- | --- | --- | | `datetime` | `DateTime` | The date and time to evaluate. | ### Returns | Type | Description | | --- | --- | | `Boolean` | `true` if `datetime` is on a workday and is no later than the end of that workday; otherwise, `false`. | ### Remarks Times before the configured start of the workday are considered valid. `TimeSpan GetRestOfWorkday(DateTime day)` Gets the duration from the specified date and time to the configured end of its workday. ### Parameters | Name | Type | Description | | --- | --- | --- | | `day` | `DateTime` | The date and time to evaluate. | ### Returns | Type | Description | | --- | --- | | `TimeSpan` | The duration until the configured workday end. The value is negative when `day` is later than that time. | ### Remarks The calculation is performed even when `day` is not a workday. `TimeSpan GetStartOfWorkday(DateTime day)` Gets the configured start time of the workday for the specified date. ### Parameters | Name | Type | Description | | --- | --- | --- | | `day` | `DateTime` | The date used to resolve individual workday settings. | ### Returns | Type | Description | | --- | --- | | `TimeSpan` | The individual start time configured for the date, or the default start time. | `DateTime FindWorkDayStart(DateTime searchFrom)` Finds the first workday start strictly later than the specified date and time. ### Parameters | Name | Type | Description | | --- | --- | --- | | `searchFrom` | `DateTime` | The exclusive lower bound for the search. | ### Returns | Type | Description | | --- | --- | | `DateTime` | The date and time when the matching workday starts. | ### Exceptions | Type | Description | | --- | --- | | `ArithmeticException` | No workday is found during the one-year search period. | `DateTime FindWorkDayEnd(DateTime searchFrom)` Finds the first workday end strictly later than the specified date and time. ### Parameters | Name | Type | Description | | --- | --- | --- | | `searchFrom` | `DateTime` | The exclusive lower bound for the search. | ### Returns | Type | Description | | --- | --- | | `DateTime` | The date and time when the matching workday ends. | ### Exceptions | Type | Description | | --- | --- | | `ArithmeticException` | No workday is found during the one-year search period. | `DateTime FindWorkDayTime(DateTime searchFrom)` Returns the specified date and time when it is accepted by [ICalendar.IsWorkTime(DateTime)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Calendars/ICalendar/); otherwise, finds the first subsequent workday start. ### Parameters | Name | Type | Description | | --- | --- | --- | | `searchFrom` | `DateTime` | The date and time to evaluate. | ### Returns | Type | Description | | --- | --- | | `DateTime` | `searchFrom` if it is accepted by [ICalendar.IsWorkTime(DateTime)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Calendars/ICalendar/); otherwise, the next workday start time. | ### Exceptions | Type | Description | | --- | --- | | `ArithmeticException` | No workday is found during the one-year search period. | `List GetWorkDaysInRange(DateTime from, DateTime to)` Gets the workday start times strictly between the specified bounds. ### Parameters | Name | Type | Description | | --- | --- | --- | | `from` | `DateTime` | The exclusive lower bound of the range. | | `to` | `DateTime` | The exclusive upper bound of the range. | ### Returns | Type | Description | | --- | --- | | `List` | The workday start times that are later than `from` and earlier than `to`, ordered chronologically. | [Previous CalendarExtensions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Calendars/CalendarExtensions/) [Next MonthDay](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Calendars/MonthDay/)