@uplink-protocol/calendar-controller
Version:
Flexible calendar API supporting both calendar and date-picker integrations for any JavaScript framework or library
96 lines (95 loc) • 3.42 kB
TypeScript
import { CalendarDate } from '../interfaces/calendar.interfaces';
import { CalendarGenerationOptions } from '../interfaces/calendar.service.interfaces';
import { ICalendarService } from '../interfaces/calendar.service.interfaces';
import { ILocalizationService } from '../interfaces/localization.service.interfaces';
/**
* Implementation of CalendarService
* Responsible for calendar generation and navigation functions
*/
export declare class CalendarService implements ICalendarService {
private _localizationService;
/**
* Set the localization service
* @param service The localization service to use
*/
setLocalizationService(service: ILocalizationService): void;
/**
* Get the localization service
* @returns The current localization service or null
*/
getLocalizationService(): ILocalizationService | null;
/**
* Generate calendar days for a specific month/year
* @param year The year
* @param month The month (0-11)
* @param options Options for calendar generation
* @returns Array of CalendarDate objects
*/
generateCalendarDays(year: number, month: number, options: CalendarGenerationOptions): CalendarDate[];
/**
* Create a calendar date object with the correct properties
* @param date The date
* @param isCurrentMonth Whether this date is in the current month
* @param today Today's date
* @param options Options for calendar generation
* @returns CalendarDate object
*/
private createCalendarDateObject;
/**
* Get month name from month index
* @param month Month index (0-11)
* @returns Month name
*/
getMonthName(month: number, short?: boolean): string;
/**
* Get weekday names starting from specified first day
* @param firstDayOfWeek First day of week (0 = Sunday, 1 = Monday, etc.)
* @returns Array of weekday names
*/
getWeekdayNames(firstDayOfWeek: number, short?: boolean): string[];
/**
* Navigate to next month from current date
* @param currentDate Current date
* @returns New date in the next month
*/
getNextMonth(currentDate: Date): Date;
/**
* Navigate to previous month from current date
* @param currentDate Current date
* @returns New date in the previous month
*/
getPreviousMonth(currentDate: Date): Date;
/**
* Navigate to next year from current date
* @param currentDate Current date
* @returns New date in the next year
*/
getNextYear(currentDate: Date): Date;
/**
* Navigate to previous year from current date
* @param currentDate Current date
* @returns New date in the previous year
*/ getPreviousYear(currentDate: Date): Date;
/**
* Check if a date is within a selected date range
* @param date The date to check
* @param range The date range (startDate and endDate)
* @returns True if the date is within the range
*/
isDateInSelectedRange(date: Date, range: {
startDate: Date | null;
endDate: Date | null;
}): boolean;
/**
* Get the ISO week number for a date
* @param date The date
* @returns The week number (1-53)
*/
getWeekNumber(date: Date): number;
/**
* Check if a date is today
* @param date The date to check
* @returns True if the date is today
*/
isToday(date: Date): boolean;
}