date-fran
Version:
Date functionalities for javascript projects.
68 lines (67 loc) • 2.98 kB
TypeScript
export declare const indexOfThrityDaysMonth: number[];
export declare const indexOfThrityOneDaysMonth: number[];
interface RR {
[key: string]: number;
}
export declare const monthAndNumberOfDays: RR;
export interface SS {
[key: number]: string;
}
export declare const monthAndIndex: SS;
export declare const actualHour: (time: string[]) => number;
export declare const currentHourString: () => string;
/**
*
* @returns yesterdays date, with the current time
*/
export declare const yesterdaysDate: () => Date;
/**
*
* @returns returns tomorrows date with the current time
*/
export declare const tomorrowsDate: () => Date;
/**
*
* @param {*} date an optional parametre of date or string type which when provided,
* the function converts to a date type and returns the current time
* @returns
*/
export declare const givenDateAndCurrentTime: (date?: string | Date) => Date;
/**
*
* @param date can be of the form "YYYY-MM-DD", "YYYY/MM/DD" or "Sun Sep 11 2022"
* @returns numerical value of month for the given date or current dat, if no argument was passed
*/
export declare const getMonth: (date?: string | Date) => number;
export declare const dateAcronym: (day: number) => "st" | "rd" | "nd" | "th" | "Invalid day number";
export declare const todaysDate: () => Date;
export declare const differenceInDays: (firstDate: string | Date, secondDate: string | Date) => number | false | undefined;
/**
* This function gives the date of the next day, in actual human context.
* A simple way of understanding the function is by saying; give me n days from now.
* @param year
* @param month javascript month structure, where january is indexed as 0
* @param dayIncrementor if this value is supplied, then the function increaes
* the date by this value; default value is one as expected
*/
export declare const dateForwardBuild: (year: number, month: number, dayIncrementor?: number) => Date;
export declare const dateConstrainer: (date: Date | string) => string;
/**
* Specifically for html forms; to ensure the choosable date begins from yesterday and backward
* @returns a string constrain to allow choosable dates from yesterday alone
* Simple usage = (document as any).querySelector(".arrival-date").max = yesterdaysFormDate();
*/
export declare const yesterdaysFormDate: () => string;
/**
* Specifically for html forms; to ensure the choosable date begins from tomorrow and forward
* @returns a string constrain to allow choosable dates from yesterday alone
* Simple usage = (document as any).querySelector(".arrival-date").max = yesterdaysFormDate();
*/
export declare const tomorrowsFormDate: () => string;
/**
* Specifically for html forms; to ensure the choosable date begins from tomorrow and forward
* @returns a string constrain to allow choosable dates from tomorrow alone
* Simple usage = (document as any).querySelector(".arrival-date").max = todaysFormDate();
*/
export declare const todaysFormDate: () => string;
export {};