@zener/nepali-date
Version:
Nepali Date is a lightweight utility designed to handle Nepali dates.
107 lines (102 loc) • 3.34 kB
text/typescript
declare const findADfromBS: (date: string) => {
toString: () => string;
year: number;
month: number;
date: number;
};
declare const findBSfromAD: (date: string) => {
toString: () => string;
year: number;
month: number;
date: number;
};
type ILang = 'np' | 'en';
declare const formatADDate: (date: Date, format?: string, lang?: ILang) => string;
type LangReturnType<T extends ILang> = T extends 'en' ? number : string;
type ADReturnType<T extends ILang> = T extends 'en' ? {
year: number;
month: number;
date: number;
toString: () => string;
} : {
year: string;
month: string;
date: string;
toString: () => string;
};
interface DateObject {
year: number;
month: number;
date: number;
day: number;
}
interface NepaliDateObject {
year: string;
month: string;
date: string;
day: string;
}
type IManipulateDate = 'day' | 'week' | 'month' | 'year' | 'd' | 'w' | 'm' | 'y';
declare class NepaliDate {
#private;
constructor();
constructor(date: string | Date | NepaliDate);
constructor(year: number, monthIndex: number, date: number);
format(format?: string, lang?: ILang): string;
toString(lang?: ILang): string;
toJson(lang?: 'en'): DateObject;
toJson(lang?: 'np'): NepaliDateObject;
toAD<T extends ILang = 'en'>(lang?: T): ADReturnType<T>;
toADasDate(): Date;
getFullYear<T extends ILang = 'en'>(lang?: T): LangReturnType<T>;
getMonth<T extends ILang = 'en'>(lang?: T): LangReturnType<T>;
getMonthName(lang?: ILang): string;
getDate<T extends ILang = 'en'>(lang?: T): LangReturnType<T>;
getDay<T extends ILang = 'en'>(lang?: T): LangReturnType<T>;
getDayName(lang?: ILang): string;
getDayNameFull(lang?: ILang): string;
subtract(value: number, type: IManipulateDate): NepaliDate;
add(value: number, type: IManipulateDate): NepaliDate;
setDate(date: number): void;
setMonth(month: number): void;
setFullYear(year: number): void;
static now(lang?: ILang): {
day: number;
toString: () => string;
year: number;
month: number;
date: number;
} | {
year: string;
month: string;
date: string;
day: string;
toString: () => string;
};
}
declare const startDateBS = 20000101;
declare const lowerADDate = -62135596800000;
declare const yearMonthDays: number[][];
declare const ENGLISH_WEEK: string[];
declare const ENGLISH_WEEK_FULL: string[];
declare const NEPALI_DIGITS: {
'0': string;
'1': string;
'2': string;
'3': string;
'4': string;
'5': string;
'6': string;
'7': string;
'8': string;
'9': string;
};
declare const NEPALI_WEEK: string[];
declare const NEPALI_WEEK_FULL: string[];
declare const ENGLISH_NEPALI_MONTH: string[];
declare const NEPALI_MONTH: string[];
declare const AD_MONTH: string[];
declare const AD_MONTH_FULL: string[];
declare const AD_MONTH_NEPALI: string[];
declare const NEPALI_TODAY = "\u0906\u091C";
export { AD_MONTH, AD_MONTH_FULL, AD_MONTH_NEPALI, ENGLISH_NEPALI_MONTH, ENGLISH_WEEK, ENGLISH_WEEK_FULL, NEPALI_DIGITS, NEPALI_MONTH, NEPALI_TODAY, NEPALI_WEEK, NEPALI_WEEK_FULL, NepaliDate as default, formatADDate, lowerADDate, startDateBS, findADfromBS as toAD, findBSfromAD as toBS, yearMonthDays };