@ce1pers/date-helpers
Version:
Simple date time helpers.
59 lines (58 loc) • 1.73 kB
TypeScript
import moment from "moment";
import { GetPassedTimeOutputs, WithFormatInput } from "./types";
/**
* ### Getting time difference.
*/
export declare const getTimeDifference: (date: Date) => number;
/**
* ### Getting time difference as seconds.
*/
export declare const getTimeDifferenceAsSeconds: (date: Date) => number;
/**
* ### Getting time difference as minutes.
*/
export declare const getTimeDifferenceAsMinutes: (date: Date) => number;
/**
* ### Getting time difference as hours.
*/
export declare const getTimeDifferenceAsHours: (date: Date) => number;
/**
* ### Divide date by eight digits time.
*/
export declare const divideDateByEight: (eight: string) => {
year: number;
month: number;
date: number;
} | null;
/**
* ### Get passed time.
*/
export declare const getPassedTime: (date: Date) => GetPassedTimeOutputs | null;
/**
* ### Convert eight digits to date.
*/
export declare const convertEightToDate: (eight: string) => Date | null;
/**
* ### Convert date to eight digits.
*/
export declare const convertDateToEight: (dateParam: Date, divider?: string) => string | null;
/**
* ### Convert date format.
*/
export declare const withFormat: (input?: WithFormatInput) => string;
/**
* ### Obtains first date of month from date or now.
*/
export declare const getFirstDateOfMonth: (month: number) => moment.Moment;
/**
* ### Obtains first date of current month.
*/
export declare const getFirstDateOfCurrentMonth: () => moment.Moment;
/**
* ### Obtains last date of month from date or now.
*/
export declare const getLastDateOfMonth: (month: number) => moment.Moment;
/**
* ### Obtains last date of current month.
*/
export declare const getLastDateOfCurrentMonth: () => moment.Moment;