@brightsoftware/date-np
Version:
Simple & minimal Nepali date picker that just works.
46 lines (45 loc) • 1.72 kB
TypeScript
import { NepaliDate } from './NepaliDate';
/**
* Format a date using the specified format string
* @param date - The date to format (Date or NepaliDate)
* @param formatString - The format string with tokens
* @returns Formatted date string
*
* @example
* // English date
* format(new Date(2025, 5, 3), 'yyyy-MM-dd') // '2025-06-03'
* format(new Date(2025, 5, 3), 'MMMM do, yyyy') // 'June 3rd, 2025'
*
* // Nepali date
* format(new NepaliDate(2082, 2, 20), 'yyyy-MM-dd') // '2082-03-20'
* format(new NepaliDate(2082, 2, 20), 'MMMM do, yyyy') // 'Aashar 20th, 2082'
*/
export declare function format(date: Date | NepaliDate, formatString: string): string;
/**
* Format a date as ISO string (yyyy-MM-dd)
* @param date - The date to format
* @returns ISO formatted date string
*/
export declare function formatISO(date: Date | NepaliDate): string;
/**
* Format a date as a long date string (MMMM do, yyyy)
* @param date - The date to format
* @returns Long formatted date string
*/
export declare function formatLong(date: Date | NepaliDate): string;
/**
* Format a date as a short date string (MM/dd/yyyy)
* @param date - The date to format
* @returns Short formatted date string
*/
export declare function formatShort(date: Date | NepaliDate): string;
/**
* Format a date as a medium date string (MMM dd, yyyy)
* @param date - The date to format
* @returns Medium formatted date string
*/
export declare function formatMedium(date: Date | NepaliDate): string;
/** Time Picker Section */
import { type TimeValue } from './TimePicker';
export declare function convertToTimeValue(time: string): TimeValue | undefined;
export declare const getCurrentTime: (hourOffset?: number) => TimeValue;