@gpa-gemstone/common-pages
Version:
Common UI pages for GPA products
39 lines (38 loc) • 1.47 kB
TypeScript
import moment from 'moment';
/**
* Interface represents picking a time based on Start Date and End Date
*/
export interface IStartEnd {
start: string;
end: string;
}
/**
* Interface represents picking a time based on Start Date and Duration
*/
export interface IStartDuration {
start: string;
duration: number;
unit: TimeUnit;
}
/**
* Interface represents picking a time based on End Date and Duration
*/
export interface IEndDuration {
end: string;
duration: number;
unit: TimeUnit;
}
export type TimeUnit = 'y' | 'M' | 'w' | 'd' | 'h' | 'm' | 's' | 'ms';
export declare const units: TimeUnit[];
export declare const dateTimeFormat = "DD MM YYYY hh:mm:ss.SSS";
/**
* A Function to determine the most appropriate unit for a window of time specified by start and end time
*/
export declare function findAppropriateUnit(startTime: moment.Moment, endTime: moment.Moment): TimeUnit;
/**
* Function to handle adding or subtracting duration
*/
export declare function getStartEndTime(center: moment.Moment, duration: number, unit: TimeUnit): [moment.Moment, moment.Moment];
export declare function addDuration(start: moment.Moment, duration: number, unit: TimeUnit): moment.Moment;
export declare function getMoment(date: string, format?: string, time?: string): moment.Moment;
export declare function readableUnit(unit: TimeUnit): "Year(s)" | "Month(s)" | "Week(s)" | "Day(s)" | "Hour(s)" | "Minute(s)" | "Second(s)" | "Millisecond(s)";