nepalipatrojs
Version:
A JavaScript library for Nepali date conversion and calendar utilities
69 lines • 3.27 kB
TypeScript
import { NepaliDate, NepaliMonth, NepaliMonthNepali, NepaliWeekDay, NepaliWeekDayNepali, NepaliPatroOptions, NepaliDatePickerOptions, DateFormatPattern } from "./types";
import { convertADToBS, getCurrentBSDate } from "./converters/ad-to-bs";
import { convertBSToAD } from "./converters/bs-to-ad";
import { getDaysInMonth, nepaliDigitsToEnglish, getDateFormatPatterns } from "./utils/helpers";
import { formatBS as formatBSDate, toNepaliDigits } from "./formatters/date-formatter";
import { NepaliDatePicker } from "./ui/NepaliDatePicker";
declare class NepaliPatro {
static readonly MIN_YEAR = 2000;
static readonly MAX_YEAR = 2099;
static readonly MIN_AD_YEAR = 1943;
/**
* Converts a Gregorian (AD) date to Bikram Sambat (BS)
* @param date AD date to convert, can be a Date object or [year, month, day] array
* @returns NepaliDate object representing the equivalent BS date
*/
static convertADToBS(date: Date | number[]): NepaliDate;
/**
* Converts a Bikram Sambat (BS) date to Gregorian (AD)
* @param bsDate BS date to convert, can be a NepaliDate object or [year, month, day] array
* @returns JavaScript Date object representing the equivalent AD date
*/
static convertBSToAD(bsDate: NepaliDate | number[]): Date;
/**
* Gets the current date in Bikram Sambat calendar
* @returns Current date as NepaliDate object
*/
static getCurrentBSDate(): NepaliDate;
/**
* Formats a Nepali date according to the specified format string
* @param date The Nepali date to format
* @param format The format string
* @param options : {} Formatting options
* @returns Formatted date string
*/
static formatBS(date: NepaliDate, format?: string, options?: NepaliPatroOptions): string;
/**
* Gets the number of days in a Nepali month
* @param year The Nepali year in BS calendar
* @param month The month (1-12)
* @returns Number of days in the specified month
*/
static getDaysInMonth(year: number, month: number): number;
/**
* Converts English digits to Nepali digits
* @param num The number to convert
* @returns String with Nepali digits
*/
static toNepaliDigits(num: number | string): string;
/**
* Converts Nepali digits to English digits
* @param text The text containing Nepali digits to convert
* @returns String with English digits
*/
static nepaliDigitsToEnglish(text: string): string;
/**
* Gets common date format patterns for parsing various date formats
* @returns Array of date format patterns with regex and index mappings
*/
static getDateFormatPatterns(): DateFormatPattern[];
/**
* Gets the current date by using .now() method
* @returns Current date as NepaliDate object
*/
static now(): NepaliDate;
}
export { NepaliDate, NepaliMonth, NepaliMonthNepali, NepaliWeekDay, NepaliWeekDayNepali, NepaliPatroOptions, NepaliDatePicker, NepaliDatePickerOptions, convertADToBS, convertBSToAD, getCurrentBSDate, formatBSDate, toNepaliDigits, nepaliDigitsToEnglish, getDateFormatPatterns, DateFormatPattern, getDaysInMonth, };
export default NepaliPatro;
export { NepaliPatro };
//# sourceMappingURL=index.d.ts.map