@cainiaofe/cn-utils
Version:
菜鸟前端基础工具库
34 lines (33 loc) • 969 B
TypeScript
import { TLanguage } from '@cainiaofe/cn-i18n';
import { Dayjs } from '../common/dayjs';
export interface DateFormatConf {
s: string;
m: string;
H: string;
D: string;
M: string;
W: 'YYYY-wo';
Q: 'YYYY-[Q]Q';
Y: 'YYYY';
HH: 'HH';
Hm: 'HH:mm';
Hms: 'HH:mm:ss';
}
export type Period = 's' | 'm' | 'H' | 'W' | 'D' | 'M' | 'Y' | 'HH' | 'Hm' | 'Hms';
export type StdFormat = 'YYYY-MM-DD HH:mm:ss' | 'YYYY-MM-DD HH:mm' | 'YYYY-MM-DD HH' | 'YYYY-MM-DD' | 'YYYY-MM' | 'YYYY' | 'YYYY-wo' | 'YYYY-[Q]Q' | 'HH' | 'HH:mm' | 'HH:mm:ss';
export type Timezone = string;
export type Timestamp = string | number;
export type FormatAutoOpts = {
period: Period;
lang?: TLanguage | boolean;
};
export type FormatOpts = {
format: string;
timezone: Timezone;
};
export type TimezoneOffset = {
offset: number;
offsetText: string;
};
export type AvailableDate = Dayjs | Timestamp | string | Date;
export type DayjsTz = Dayjs;