UNPKG

date-manip

Version:

A lightweight JavaScript date utility library that provides modularity, high performance, and additional features. It supports various date operations, including date addition and subtraction, formatting, comparison, etc.

23 lines (22 loc) 836 B
interface CompileResult { pattern: string; tokens: string[]; } /** * Compile a format string into a regular expression and extract date parts. * 编译格式字符串,生成正则表达式和匹配的日期部分 * * @param formatString - The format string to compile. (要编译的格式字符串。) * @returns A compiled result object containing the regular expression pattern and extracted date parts. * (包含正则表达式模式的编译结果对象,以及提取的日期部分。) * @example * ```ts * compile('YYYY-MM-DD HH:mm:ss.SSS'); * // { * // pattern: '(\\d{1,4})-(\\d{1,2})-(\\d{1,2}) (\\d{1,2}):(\\d{1,2}):(\\d{1,2})\\.(\\d{1,3})', * // tokens: ['YYYY', 'MM', 'DD','HH', 'mm', 'ss', 'SSS'] * // } * ``` */ export default function compile(formatString: string): CompileResult; export {};