@nateradebaugh/react-datetime
Version:
A lightweight but complete datetime picker React.js component
56 lines (55 loc) • 1.84 kB
TypeScript
import React, { FC } from "react";
import { Locale } from "date-fns";
export declare const FORMATS: {
MONTH: string;
SHORT_MONTH_NAME: string;
FULL_MONTH_NAME: string;
SHORT_DAY: string;
DAY: string;
SHORT_DAY_OF_WEEK: string;
YEAR: string;
MILITARY_HOUR: string;
HOUR: string;
SHORT_HOUR: string;
SHORT_MINUTE: string;
MINUTE: string;
SHORT_SECOND: string;
SECOND: string;
SHORT_MILLISECOND: string;
MILLISECOND: string;
AM_PM: string;
FULL_TIMESTAMP: string;
};
export interface FormatOptions {
locale: Locale | undefined;
weekStartsOn: WeekStartsOn | undefined;
}
export interface TimeConstraint {
step: number;
}
export interface TimeConstraints {
hours?: TimeConstraint;
minutes?: TimeConstraint;
seconds?: TimeConstraint;
milliseconds?: TimeConstraint;
}
export declare type ViewMode = "days" | "months" | "years" | "time";
export declare type DateTypeMode = "utc-ms-timestamp" | "input-format" | "Date";
export declare type WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;
export declare type Props = DateTimeProps;
export interface DateTimeProps extends Omit<React.HTMLProps<HTMLInputElement>, "onFocus" | "onBlur" | "onChange" | "value"> {
isValidDate?: (date: Date) => boolean;
dateTypeMode?: DateTypeMode;
value?: string | number | Date;
onChange?: (newValue: undefined | string | number | Date) => void;
onFocus?: () => void;
onBlur?: (newValue: undefined | string | number | Date) => void;
dateFormat?: string | boolean;
timeFormat?: string | boolean;
locale?: Locale;
weekStartsOn?: WeekStartsOn;
shouldHideInput?: boolean;
timeConstraints?: TimeConstraints;
}
export declare const DateTime: FC<Props>;
export default DateTime;