UNPKG

@brightsoftware/date-np

Version:

Simple & minimal Nepali date picker that just works.

52 lines (51 loc) 2.13 kB
import { type BS_MONTHS_KEYS } from "../data/constants.ts"; import { NepaliDate } from "../src/NepaliDate.ts"; /** * @category helpers * This is the helper functions for the date-np package. * @showCategories * @module */ /** * @category helpers * Calculates the total number of days from MIN_BS_YEAR to the given BS date. * @param {NepaliDate} BS_date - The BS date to calculate the total days to. * @returns {number} - The total days from the given BS date. */ declare const calcTotalDaysFromMinBS: (BS_date: NepaliDate) => number; /** * @category helpers * Calculates the total number of days in the given BS year. * @param {yearInput} year - The BS year to calculate the total days in. * @returns {number} - The total days in the given BS year. */ declare const calcTotalDaysInBSYear: (year: yearInput) => number; declare const addDaysToMinBSDate: (days: number) => NepaliDate; declare const calcTotalDaysFromMinAD: (AD_date: Date) => number; export type yearInput = Date | BS_MONTHS_KEYS | number; /** * @category helpers * Extracts the year from the given input. * @param {Date | BS_MONTHS_KEYS | number} input - The input to extract the year from. * @returns {number} - The extracted year. */ declare const extractYear: (input: Date | BS_MONTHS_KEYS | number) => number; export type tgetMonthTotalDaysProps = { date: Date | NepaliDate; locale: "en" | "ne"; }; /** * This function assumes you send date according to the locale */ declare const getTotalDaysInMonth: ({ date, locale }: tgetMonthTotalDaysProps) => number; /** * This function accepts date in locale range. * And gives the first day of the month in numeric form. */ declare const getStartingDayOfMonth: ({ date, locale }: tgetMonthTotalDaysProps) => number; /** * Calculates and returns the last day of the month according to the locale * provided */ declare const getEndingDayOfMonth: ({ date, locale }: tgetMonthTotalDaysProps) => number; export { calcTotalDaysFromMinBS, calcTotalDaysInBSYear, calcTotalDaysFromMinAD, addDaysToMinBSDate, extractYear, getTotalDaysInMonth, getStartingDayOfMonth, getEndingDayOfMonth, };