@brightsoftware/date-np
Version:
Simple & minimal Nepali date picker that just works.
87 lines (86 loc) • 3.75 kB
TypeScript
import { type yearInput } from "./helpers";
import { NepaliDate } from "../src/NepaliDate";
/**
* @categoryDescription validators
* These are the validators for the date-np package.
* @showCategories
* @module
*/
/**
* @category validators
* Checks if the given date is a valid BS date.
* @param {Date} yearInput - The date to be checked.
* @returns {boolean} - True if the date is a valid BS date, false otherwise.
*
*/
declare const isValidBSYear: (yearInput: yearInput) => boolean;
declare const isValidADYear: (yearInput: yearInput) => boolean;
declare const isADLeapYear: (yearInput: yearInput) => boolean;
/**
* @category validators
* Checks if the given date is a valid AD date.
* @param {Date} AD_date - The date to be checked.
* @returns {boolean} - True if the date is a valid AD date, false otherwise.
*/
declare const isValidADRange: (AD_date: Date) => boolean;
/**
* @category validators
* Checks if the given date is a valid BS date.
* The date before 2000 poush 17 is not valid as of now.
* Will try to fix this later on. TODO: Fix this.
*
* @param {NepaliDate} BS_date - The date to be checked.
* @returns {boolean} - True if the date is a valid BS date, false otherwise.
*/
declare const isValidBSRange: (BS_date: NepaliDate) => boolean;
/**
* Checks whether if two dates are equal or not.
* Ignores there time and only checks the year month and date.
* @param {Date | NepaliDate} date1 - The first date to be checked.
* @param {Date | NepaliDate} date2 - The second date to be checked.
*
* @returns {boolean} - True if the dates are equal, false otherwise.
*/
declare const areDatesEqual: (date1: Date | NepaliDate, date2: Date | NepaliDate) => boolean;
/**
* @category validators
* Compare two dates for ordering. Returns -1 if date1 < date2, 0 if equal, 1 if date1 > date2
* @param {Date | NepaliDate} date1 - First date to compare
* @param {Date | NepaliDate} date2 - Second date to compare
* @returns {number} - Comparison result (-1, 0, or 1)
*/
declare const compareDates: (date1: Date | NepaliDate, date2: Date | NepaliDate) => number;
/**
* @category validators
* Check if first date is before second date
* @param {Date | NepaliDate} date1 - First date
* @param {Date | NepaliDate} date2 - Second date
* @returns {boolean} - True if date1 is before date2
*/
declare const isDateBefore: (date1: Date | NepaliDate, date2: Date | NepaliDate) => boolean;
/**
* @category validators
* Check if first date is after second date
* @param {Date | NepaliDate} date1 - First date
* @param {Date | NepaliDate} date2 - Second date
* @returns {boolean} - True if date1 is after date2
*/
declare const isDateAfter: (date1: Date | NepaliDate, date2: Date | NepaliDate) => boolean;
/**
* @category validators
* Check if a date falls between two other dates (inclusive)
* @param {Date | NepaliDate} date - Date to check
* @param {Date | NepaliDate} startDate - Start of range
* @param {Date | NepaliDate} endDate - End of range
* @returns {boolean} - True if date is between startDate and endDate
*/
declare const isDateBetween: (date: Date | NepaliDate, startDate: Date | NepaliDate, endDate: Date | NepaliDate) => boolean;
/**
* @category validators
* Check if minDate is greater than maxDate (invalid configuration)
* @param {Date | NepaliDate} minDate - Minimum date
* @param {Date | NepaliDate} maxDate - Maximum date
* @returns {boolean} - True if minDate > maxDate (invalid), false otherwise
*/
declare const isInvalidDateRange: (minDate: Date | NepaliDate, maxDate: Date | NepaliDate) => boolean;
export { isValidBSYear, isValidADYear, isADLeapYear, isValidADRange, isValidBSRange, areDatesEqual, compareDates, isDateBefore, isDateAfter, isDateBetween, isInvalidDateRange };