UNPKG

1.47 kBTypeScriptView Raw
1export interface ToDateStringOptions {
2 /**
3 * 自定义格式化模板
4 * {
5 * formats: {
6 * q: ['日', '一', '二', '三', '四', '五', '六'],
7 * E: function (value, match, date) { return '三' }
8 * }
9 * }
10 */
11 formats?: any
12}
13
14/**
15 * 日期格式化为任意格式字符串,转义符号 []
16 * @param date 字符串/日期/时间戳
17 */
18export declare function toDateString(date: string | Date | number): string;
19export declare function toDateString(date: any): string;
20
21/**
22 * 日期格式化为任意格式字符串,转义符号 []
23 * @param date 字符串/日期/时间戳
24 * @param format 格式化 默认:yyyy-MM-dd HH:mm:ss.SSS
25 */
26export declare function toDateString(date: string | Date | number, format: string | null): string;
27export declare function toDateString(date: any, format: string | null): string;
28
29/**
30 * 日期格式化为任意格式字符串,转义符号 []
31 * @param date 字符串/日期/时间戳
32 * @param format 格式化 默认:yyyy-MM-dd HH:mm:ss.SSS
33 * @param options 可选参数
34 */
35export declare function toDateString(date: string | Date | number, format: string | null, options: ToDateStringOptions): string;
36export declare function toDateString(date: any, format: string | null, options: ToDateStringOptions): string;
37
38declare module './ctor' {
39 interface XEUtilsMethods {
40 toDateString: typeof toDateString;
41 }
42}
43
44export default toDateString