UNPKG

nepalipatrojs

Version:

A JavaScript library for Nepali date conversion and calendar utilities

46 lines 1.91 kB
import { NepaliDate, DateFormatPattern } from '../types'; /** * 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 * @throws Error if data is not available for the given year */ export declare function getDaysInMonth(year: number, month: number): number; /** * Parses different date input formats into a standardized object * @param date Date input, either as a NepaliDate object or [year, month, day] array * @returns Standardized date object with year, month, and day properties * @throws Error if the date format is invalid */ export declare function parseDateInput(date: NepaliDate | number[]): { year: number; month: number; day: number; }; /** * Localize number to Nepali digits based on language * @param num The number to localize * @param language The language code ('en' or 'np') * @returns Localized string with Nepali digits if language is 'np', otherwise returns the original number as a string */ export declare function localizeDigits(num: string | number, language: string): string; /** * Localizes the month name based on the language * @param month The month number (1-12) * @param language The language code ('en' or 'np') * @returns Localized month name in either English or Nepali */ export declare function localizeMonth(month: number, language: string): string; /** * Converts Nepali digits to English digits * @param text The text containing Nepali digits to convert * @returns String with English digits */ export declare function 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 */ export declare function getDateFormatPatterns(): DateFormatPattern[]; //# sourceMappingURL=helpers.d.ts.map