jb-date-input
Version:
jalali date input web component
47 lines • 2 kB
TypeScript
import { type InputType } from "./jb-date-input";
import type { JBDateInputValueObject, BeforeInputHandlerResponse } from "./types";
export declare function isLeapYearJalali(year: number): boolean;
export declare function getEmptyValueObject(): JBDateInputValueObject;
export declare function getMonth(value: string): string;
export declare function getYear(value: string): string;
export declare function getDay(value: string): string;
export declare function handleDayBeforeInput(inputType: InputType, typedNumber: number, caretPos: number, value: string, inputChar: (char: string, pos: number) => void): {
isIgnoreChar: boolean;
caretPos: number;
};
export declare function handleMonthBeforeInput(inputValue: string, typedNumber: number, caretPos: number): {
isIgnoreChar: boolean;
caretPos: number;
};
export declare function checkMinValidation(date: Date, minDate: Date): boolean;
export declare function checkMaxValidation(date: Date, maxDate: Date): boolean;
export declare function isValidChar(char: string): boolean;
export declare function standardString(dateString: string): string;
/**
* will input and replace a certain char in the given string
*/
export declare function replaceChar(char: string, pos: number, currentValue: string, showPersianNumber?: boolean): string;
type BeforeInputParameters = {
dateInputType: InputType;
showPersianNumber?: boolean;
value: string;
selection: {
start: number;
end: number;
};
event: {
inputType: string;
data: string | null;
};
};
export declare function handleBeforeInput(params: BeforeInputParameters): BeforeInputHandlerResponse;
type HandleFocusParams = {
selectionStart: number | null;
inputValue: string;
};
/**
* return best caret pos base on current input caret pos (move caret pos to last empty char of each section)
*/
export declare function getFixedCaretPos(params: HandleFocusParams): number | null;
export {};
//# sourceMappingURL=utils.d.ts.map