Service for working with a business calendar.

interface IBusinessCalendarService {
    addWorkingDaysToDate(
        dateTime: string,
        daysOffset: number,
        calendarCardId: string,
        timeZoneUtcOffsetMinutes?: number,
    ): Promise<string>;
    addWorkingQuantsToDate(
        dateTime: string,
        calendarCardId: string,
        quants: number,
        timeZoneUtcOffsetMinutes?: number,
    ): Promise<string>;
    calendarAddWorkingDaysToDateExact(
        dateTime: string,
        interval: number,
        calendarCardId: string,
        timeZoneUtcOffsetMinutes?: number,
    ): Promise<string>;
    getAllCalendarInfos(): Promise<CalendarInfo[]>;
    getCalendarInfo(calendarIntId: number): Promise<null | CalendarInfo>;
    getDateDiff(
        dateTimeStart: string,
        dateTimeEnd: string,
        calendarCardId: string,
        timeZoneUtcOffsetMinutes?: number,
    ): Promise<number>;
    getDefaultCalendarInfo(): Promise<null | CalendarInfo>;
    getDefaultTimeZoneInfo(): Promise<null | TimeZoneInfo>;
    getFirstQuantStart(
        dateTime: string,
        daysOffset: number,
        calendarCardId: string,
        timeZoneUtcOffsetMinutes?: number,
    ): Promise<string>;
    getLastQuantEnd(
        dateTime: string,
        daysOffset: number,
        calendarCardId: string,
        timeZoneUtcOffsetMinutes?: number,
    ): Promise<string>;
    getRoleCalendarInfo(roleId: string): Promise<null | CalendarInfo>;
    getRoleTimeZoneInfo(roleId: string): Promise<TimeZoneInfo>;
    isWorkingTime(
        dateTime: string,
        calendarCardId: string,
        timeZoneUtcOffsetMinutes?: number,
    ): Promise<boolean>;
    rebuildCalendar(
        operationId: string,
        calendarCardId: string,
        rebuildIndexes?: boolean,
    ): Promise<void>;
    validateCalendar(calendarCardId: string): Promise<ValidationResult>;
}

Implemented by

Methods

  • Offsets from the specified date/time by the specified number of estimated business days..

    Parameters

    • dateTime: string

      Date and time.

    • daysOffset: number

      Offset in working days. Can be a non-integer number.

    • calendarCardId: string

      Calendar card ID.

    • OptionaltimeZoneUtcOffsetMinutes: number

      Time zone offset in minutes.

    Returns Promise<string>

    New date and time.

  • Adds the specified working time in quants to the specified date/time.

    Parameters

    • dateTime: string

      Date and time.

    • calendarCardId: string

      Calendar card ID.

    • quants: number

      Working time in quants.

    • OptionaltimeZoneUtcOffsetMinutes: number

      Time zone offset in minutes.

    Returns Promise<string>

    New date and time.

  • Adds the specified number of actual business days to the specified date/time.

    Parameters

    • dateTime: string

      Date and time.

    • interval: number

      Number of working days.

    • calendarCardId: string

      Calendar card ID.

    • OptionaltimeZoneUtcOffsetMinutes: number

      Time zone offset in minutes.

    Returns Promise<string>

    New date and time.

  • Retrieves information about calendars.

    Returns Promise<CalendarInfo[]>

  • Retrieves information about a calendar by its numeric identifier.

    Parameters

    • calendarIntId: number

      Calendar numeric identifier.

    Returns Promise<null | CalendarInfo>

  • Calculates working hours between two specified dates.

    Parameters

    • dateTimeStart: string

      Start date.

    • dateTimeEnd: string

      End date (must be greater than start date).

    • calendarCardId: string

      Calendar card ID.

    • OptionaltimeZoneUtcOffsetMinutes: number

      Time zone offset in minutes.

    Returns Promise<number>

    Working time in quants between two specified dates.

  • Retrieves information about the default calendar.

    Returns Promise<null | CalendarInfo>

  • Retrieves information about the default time zone.

    Returns Promise<null | TimeZoneInfo>

  • Gets the start of the first work quant of the workday, obtained as an offset from the given date.

    Parameters

    • dateTime: string

      Date in abstract calendar time.

    • daysOffset: number

      Offset in working days.

    • calendarCardId: string

      Calendar card ID.

    • OptionaltimeZoneUtcOffsetMinutes: number

      Time zone offset in minutes.

    Returns Promise<string>

    The date/time in abstract calendar time of the beginning of the first working quant of the working day.

  • Gets the end of the last working quant of the working day, obtained by offset from the given date.

    Parameters

    • dateTime: string

      Date in abstract calendar time.

    • daysOffset: number

      Offset in working days.

    • calendarCardId: string

      Calendar card ID.

    • OptionaltimeZoneUtcOffsetMinutes: number

      Time zone offset in minutes.

    Returns Promise<string>

    Date\time in abstract calendar time of the end of the last working quant of the working day.

  • Gets calendar information for the specified role.

    Parameters

    • roleId: string

      Role ID.

    Returns Promise<null | CalendarInfo>

  • Retrieves information about the time zone of the specified role.

    Parameters

    • roleId: string

      Role ID.

    Returns Promise<TimeZoneInfo>

  • Checks whether the specified date/time in the abstract calendar time is working date/time.

    Parameters

    • dateTime: string

      Date and time to check.

    • calendarCardId: string

      Calendar card ID.

    • OptionaltimeZoneUtcOffsetMinutes: number

      Time zone offset in minutes.

    Returns Promise<boolean>

    true if the specified date\time is working; otherwise - false.

  • Rebuilds the calendar based on the specified settings, incl. list of exceptions.

    Parameters

    • operationId: string

      Operation ID.

    • calendarCardId: string

      Calendar card ID.

    • OptionalrebuildIndexes: boolean

      A sign that indexes in calendars need to be rebuilt.

    Returns Promise<void>

  • Checks the calendar for absence of gaps between quants.

    Parameters

    • calendarCardId: string

      Calendar card ID.

    Returns Promise<ValidationResult>

    Validation result.

MMNEPVFCICPMFPCPTTAAATR